U.S. District Judge Edward Chen said Tuesday the ban on nudity doesn't violate free speech.
"Nudity is not inherently expressive," Chen wrote in his ruling. "The ordinance's general ban on public nudity for the most part regulates conduct only."
He said he would consider a lawsuit if the city enforced the ban against nude protesters if their nudity was part of their message, the San Francisco Chronicle reported.
The suit was filed by a group of activists including George Davis, who petitioned to run for mayor in 2007 as the "naked candidate."
Scarlett Johansson steps out with fiance after pregnancy reveal
Teacher apologizes for showing sexual image of herself in class