Lately I can't stop thinking about my horrible high school teacher.
Did you do anything to make your teacher dislike you?
No, but my grade is the highest in the whole class and he's still not happy.
We can be haunted by the past because we haven't learned mindful ways of releasing our attachment to things, events, memories and people. Talk to someone about your issue with your teacher and find a way to move on from the toxic thoughts.
I'm going to spend the whole day in school because I don't want to leave
I can see that this is really affecting you. I understand that it may be really rough to go through with all the effort that you're putting into school. Seeking out therapy could be beneficial to help relieve some stress from you.