Usually they are protected in dress-code cases as long as they are not conveyed in a vulgar or lewd fashion. In Tinker v. Des Moines Independent Community School Dist. (1969), the U.S. Supreme Court ruled that public school students could wear black armbands to school to protest U.S. involvement in the Vietnam. The Court noted that the students were engaging in a form of symbolic speech that was “akin to pure speech.” In later decisions, courts have recognized that students have more protection when they engage in political expression.
However, the language used to convey a political message on dress can be very important. For example, in 1992 one federal court rejected a Virginia student’s First Amendment claim that she should not be punished for wearing a “Drugs Suck” T-shirt to class. Even though the message spoke to an important political topic, the court determined that the word “sucks” was too vulgar and could be prohibited.
The issue is a bit different with respect to school-uniform policies. If a public school adopts a uniform policy, they can prohibit T-shirts with any messages, including political messages. However, the school could not constitutionally prohibit students from wearing political buttons or logos on their school uniforms.