This is a classic problem for writers. I once heard a lecture by Isaac Asimov, a well-known science fiction writer, where he said that his first attempt at writing fiction was set in a small town, and people told him that was a bad idea because he had, at that point in his life, never been outside New York City. But, he said, he went on to write stories set on other planets, and he'd never been to another planet either.
The answer is: Do research. If you know people who have attended public school, ask them about their experiences. Read other books set in public schools. Etc.
Think about what matters and what doesn't. Avoid glaring errors. Like if the story is set in the United States, a school run by the government is called a "public school". In the UK, a "public school" is a school that is NOT run by the government, what Americans call a "private school". The meaning is exactly the opposite. Maybe you would never make that particular mistake, but you want to watch for that SORT of mistake.
I saw a documentary about a murder in the town of Wendover, Nevada. My daughter lives in Wendover so I've been there many times. (Which is mostly why the documentary caught my interest.) The documentary had many re-enacted scenes. One was set in the parking lot of the local high school. And so we see two people standing by a car in the parking lot, and behind them is a thick forest. Except, umm, Wendover is in the desert. I don't think there are ten trees in the entire town. I've been to the high school, I think there's one scraggly tree in the parking lot. Clearly this scene was filmed nowhere near Wendover. I found it laughably out of place. Did it affect the story? No, not at all. But to me it was glaring.
Get the physical environment right. Get names of things right.
Much tougher: Get the "general way things go" right. I saw a movie once that was supposed to be about a group of American missionaries in South America. At one point they split up, and as they're separating, one says, "The Lord be with you", and the other replies, "May God watch over you", and they go back and forth with religious sounding goodbye statements for five or six rounds. I've attended evangelical churches all my life. I've spoken to many missionaries. I once visited one of our church's missions in another country. And I can tell you, we don't talk that way. Someone might make one such statement of farewell, but if he gave a string of two or three in a row, the other missionaries would be staring at him strangely wondering what had come over him or what he was trying to prove. Whoever wrote this script apparently took all the "religious sounding" sentences he knew and tried to cram them into one conversation. Any one would have been believable, but putting them all together sounded simply silly.
My point, of course, is not this particular mistake, but mistakes LIKE this. In your case, how do students talk when they're in math class? What do teachers say when they meet the principal in the hall? What do students and teachers wear? What really happens every day in a typical classroom? Etc.
You can get away with unreality that is necessary to your story. I don't suppose that vampires really wander the halls of American high schools, but they put that in Buffy the Vampire Slayer and the audience accepted it because that was the story.