Do not listen to your friends' opinions. If they know that you have a crush on him, they're likely to (unintentionally) misinterpret the things your teacher does/ says to you, as they want to support & root you on. Especially as if they know you have a crush on him, they're likely to become hyperaware when listening to you guys speak/ watching your interactions, and make up their own versions of what went down. It's human nature.
I went through the same thing when I was your age. I had a huge crush on this one teacher, and I'd study especially hard for his subject as I wanted to impress him. Like I'd do loads of further reading etc. and I'd get constant 99%s on his exams (we had a running joke where he'd never give me 100%). I'm fairly sure that he knew I had a crush on him though, as I'd always go bright red whenever he spoke to me. I was young & naive and genuinely though I had a chance with him; I misinterpreted a lot of situations which looking back on now, were harmless encounters. For example, I once asked him if he would be the teacher in charge of marking our end-of-year exams, and he gave me a smirk and said "Yes, why, are you trying to bribe me?" Looking back on it now, I'd interpret that situation as a teacher joking around with their star pupil; but at the time, 15 y/o me took it the slightly wrong, PG way lmao.
He also thought I was dating someone in the class, and would make us sit on opposite ends of the classroom - me, next to his desk; the other guy, at the back of the room, as far away from my desk as possible. Again, at the time, I thought that it was because my teacher was jealous. Looking back on it now, he probably just separated us like that as we were super close and talkative & as such, would often disrupt the class due to our laughing/ chitchat.
Ironically, given all the further reading & extra studying I did for the subject (paired with the fact that I was "a natural" at it, according to my teacher, which again made 15 y/o me think he liked me LOL), I soon developed a passion for it. I thus decided to take it at A-Level, and coincidentally ended up getting the teacher again. I found him attractive throughout sixth form, I'll admit that - but I realised by Year 13 that my crush had faded. I no longer cared about what he thought about me. I didn't put an obscene amount of effort into his class, and would not get jealous watching him talk to other students/ his girlfriend (who was also a teacher). I realised that I didn't care about him at all anymore. I got a boyfriend my age at my school, and moved on. Yes, I'll admit that he was (and still is) a highly attractive man to me (a controversial view, as my 2 friends who knew I had a crush on him found him ugly). But I no longer yearn for him the way I used to. When I left high school, I didn't even feel crushed at the prospect of knowing I'd never see him again. I felt genuinely indifferent.
My point here is, you may feel that you'll never move on: but trust me, you will. You WILL grow out of this phase. I hard-crushed on this teacher for years, and at one point felt so sad & empty at the thought that I'd never have him. I thought that he was THE ONE (lmao, teenagers be like..). But I realise now that like every other crush, it fades away. He will never see you the way you see him, especially if his reputation & career are on the line. If you strongly, truly do think that you have a chance with him: do NOT act on it. Wait until you're no longer his student & provided he's single, try to reconnect with him when you're older. Till then, focus on your grades & consider guys your own age. I know its hard, but you have to be realistic. Fortunately for me, my friends who knew I liked him were brutally honest with me. They told me time after time again that what I was interpreting as flirtatious behaviour from him was nothing at all. They told me day after day that I had no chance, that he had a girlfriend, that our age gap was way too large for him to even see me as attractive let alone consider being with me, etc. I owe a lot to these friends.
P.S. I do not regret having my crush on this teacher. Because without him, I would have never paid so much attention to the subject he was teaching me. I am now a third-year student at university studying said subject, which I would have never even taken - I only took it at GCSE because I wanted him to teach me (as I knew I had a 50-50 chance of getting him as my subject teacher). Things do work out: I didn't end up in a relationship with said teacher (which crushed teenage me, but adult me is super grateful for) but I ended up finding the perfect uni course for me.