I attended public school in the 50’s and 60’s. We had a dress code. I agree with dress codes. This has nothing to do with liberty. Schools where I live ask the kids not to wear band t-shirts. Should they sue? No.
Once you introduce taxpayer funding into the equation, you open up all sorts of problems. Mandatory dress codes are a great example. (We have them here too, but they’re voluntary. They can’t legally sustain a mandatory code.)
It’s just better for the government to stay out of education, and many other areas of our life. That’s why we home school our kids. We’ve also paid for private school in the past.