The reason you are in school is to learn and get a proper education, so take the energy you would normally spend thinking about your teacher and re-focus on it and also on your work. You’ll see improvements in your academic performance and it will take your mind off your teacher. Thoughts frequently lead to action and visualizing something makes it more likely to occur and people will see you. Thinking about your teacher increases your chances of doing something you might later regret. Try focusing on things about your teacher that you don't like. The idea here is not to dwell on the negatives, but to remind yourself that the relationship was not as perfect as you remember it being, e.g. Age difference, appearances. Interact with your teacher in class, but do not seek them out or try to spend time with them outside of your designated class time. It just isn't right for you, especially as they are probably quite a bit older than you. It is generally okay to date a person older than you in later life, but a young person dating an older teacher is often considered inappropriate. Do not contact them on social media or try to meet with them outside of school. Respect their position as your teacher and give them the space that they need to do that job well. Making decisions in advance about how you will handle your impulses can help you to be more successful in conquering them. Think about how you’d like to act when talking to your teacher and then follow through on your plan.
Focus on your studies. Stop thinking about your teacher romantically. Limit your interactions with your teacher. Utilize if-then planning.