I'm thinking of writing my name on my classmate's homework, and turning it in.
That feels very bad, why would you turn in your classmates' homework?
I'm torn. On one hand, I don't want to get caught. But on the other hand, my classmate is really stupid and it'd be funny if he failed the class
It would not be good to turn in homework that doesn't belong to you. You could get in trouble with the teacher and get detention or expelled.
I was much better at this when I was in high school.
Not only you will be cheating if you do this, but you will also purposefully making your classmate fail the homework, and that is not a great thing to do, as you will be caught one way or another. You will be responsible for your actions and you may regret it in the end, specially with what you did with your classmate who may have exerted good effort with that homework.