Crushing on teacher is typical of the teenage student. Many if not most students find that one teacher that really does 'it' for them. Lots of articles are out there, start reading up.
Most teachers are aware that this sort of thing happens. And those that it happens to are often flattered, but are not going to take advantage of the student.
Unlike everyone else I'm going to make a horrible, scary, terrifying suggestion.
Talk to this teacher about your feelings, and explain to him you are in the closet and you don't want anyone to know.
There is a certain level of student/teacher confidence that is maintained. He won't tell anyone you are gay or that you have a crush on him - unless either and or both of these become a real problem, like you start stalking him or trying to pick up on him, or follow him home one night, slip into his house, tie him down and have your way with him.
He is obligated to tell about abuse, about suicidal thoughts, and other things which poise a harm to yourself or others. So I would strongly urge you to not discuss with him your thoughts of self murder.
He is worried about you, he has noted your lack of being their and most likely fears you are in an abusive situation at home or on drugs or some other horrific thing and is trying to reach out to you. He is a good teacher and this part of his job to reach out, understand the student and make certain the student is safe.
I can assure you he most likely already knows that its his class that you have issues with. Most likely already checked your schedule and talked a little with your other teachers.
It would ease his mind a lot to know your step dad isn't beating the crap out of you nightly, or that you are doing drugs behind the bleachers or something.
So telling him your gay and crushing on him most likely will be a relief to his mind than a 'problem'.
Avoiding him, avoiding the class, missing on your studies is going to cause more problems than fessing up.
Yes he is going to tell you that crush as hard as you want there is no hope of anything between you two. Even if he is gay. Its just a no-go type situation, that is even questionable when the age difference is closer and the student graduates thus no longer actually a student. Society frowns on the concept.