You can wear whatever you want because the First Amendment protects freedom of expression (including choice of clothing) but by going to the school you must agree to its dress codes, regardless. There are also laws that make exceptions to the First Amendment, like if an assembly becomes a riot, or in the case of clothing, public indecency.
True: Wearing a swim suit to school is not protected under the First Amendment. If it were, the school wouldn't be able to have a dress code.