A city high-school principal sparked a raucous sit-in when she lectured students on the dress code, insisting, “What you wear is your intent.”

About 150 students at the highly regarded Museum School in Chelsea wrote protest messages on their bodies and flooded the hallway in revolt against what they called Principal Darlene Miller’s “slut shaming” and the “rape culture” of blaming women for sexual assaults.

Miller, 70, sparked the uproar during a sophomore assembly Wednesday, when she vowed to require dress-code violators to wear large shirts that would make them look like a “sack of potatoes,” witnesses said.

She then made the stern rebuke, “What you wear is your intent,” several students told The Post.

The next morning, students put up posters and fliers. “Stop teaching girls what to wear and start teaching PEOPLE what to think!” one said. Administrators ran up and down the hall ripping them down.

“I’m focused on my education but you’re focused on my chest,” sophomore Ashley Hawkins, 15, scrawled on the skin below her collarbone, and showed off the message by wearing a tank top.

Another student, Lilah Webb, 15, said a poster she tried to put up was yanked from her hands by the dean, Angela Skirianos. Webb wore a hand lettered T-shirt that read, “End Rape Culture.”

Administrators forbid her to go to classes for most of the day, saying her shirt was disruptive and bore vulgar language.

Jeidy Aloi, 16 — who wore a shirt that read “What I wear is not my intent. Stop glorifying rape culture” — was also banned from classes,

During lunch Thursday, kids poured into the hall and sat down, shouting “What I wear is not my intent!” and “I respect myself!” The noisy protest was captured by cell-phone cameras.

Students said the crackdown seemed targeted at girls.

“F–k the double standard,” declared a boy who stripped off his shirt.

Kids also chanted “DUI” — a knock at Miller’s 2011 arrest for drunken-driving after she smashed her car into a parked South Nyack police cruiser. She failed to report the arrest to the DOE, officials said at the time.

Miller, who makes $157,000 a year, pleaded not guilty. Her trial has been repeatedly delayed over the past five years, with the latest court date set for June 5. The Department of Education said it cannot impose any discipline until the criminal case is resolved.

“It’s insane that she was able to keep her job,” a student said, adding that Miller rarely leaves her office.

During the protest, an NYPD cop showed up with a trainee, but was “smiling and laughing and chanting with us,” before leaving minutes later, a student said.

The teens ended the hour-long protest after Miller invited 10 of them to meet with her to discuss their concerns.

Webb said her classmates did not want to bash the school, but to improve communication between students and staff.

But at least two girls defied the dress code Friday, coming to school in midriff-bearing and low cut tops. A teacher told one to “close up” her shirt.

Miller did not return messages seeking comment.