Jill Bloomberg, the outspoken and popular principal of Park Slope Collegiate, appeared in federal court Monday to ask a judge to temporarily halt a Department of Education investigation against her.

In a lawsuit filed Friday, Bloomberg alleges that the city launched its probe in retaliation for her activism on behalf of her students. “What speech is prohibited?” she asked outside the courtroom. “The speech I am most known for is anti-racism.”

The investigation started, according to the suit, soon after she complained to the Department of Education about how sports teams were allocated to the four different schools that comprise the John Jay Campus in Park Slope, where her school is based. Bloomberg wrote that Millennium Brooklyn, the school with the largest percentage of white students, has a separate sports program shared with its affiliated Manhattan high school, and together they had more teams than the other schools in the building combined.

In March, the suit alleges, an investigator from the Office of Special Investigations, an arm of the DOE, visited Park Slope Collegiate and told Assistant Principal Carla Laban that the investigation pertains to “communist activities taking place at the school.”

The city denies any retaliation against Bloomberg. It argues that it first received a confidential complaint in May 2016 that Bloomberg was “actively recruiting students to participate in a political party,” later identified as the Progressive Labor Party. (The website for that party does acknowledge communist ties; Bloomberg says she is not a member.)

Bloomberg’s alleged political advocacy is a violation of two Chancellor’s Regulations, the city argues, which “prohibit the use of school facilities, equipment and supplies on behalf of political organizations.”

Bloomberg’s attorney Jeanne Mirer said in court that the allegations were false, and were having a chilling effect on the First Amendment rights of both Bloomberg and her colleagues.

“People who support civil rights and integration have long been called communists,” Mirer told the judge. “That’s why this investigation is so dangerous.”

Teachers, students and other supporters of Bloomberg, many wearing matching black anti-racism T-shirts, lined the walls of the courtroom. At one point, the city’s attorney suggested that the mere presence of so many supporters was proof that the investigation hadn’t had a chilling effect on school staff, prompting murmurs of disapproval from those gathered.

When the hearing adjourned, Bloomberg’s supporters gathered outside the courtroom.

“I’ve worked for her for over a decade,” said Sarah Vega, a special education teacher at the school. “I’ve never seen her furthering any political agenda whatsoever. She fights against racism, but I don’t really consider that partisan politics.”

Maya, 13, an eighth-grader at Park Slope Collegiate, also backs Bloomberg. “It’s just upsetting that she’s being accused of stating her own political views when she’s just stating the facts that racism is here,” she said.

“I don’t see what that has to do with communism,” her mother agreed.

At least one parent at the hearing took a more neutral stance. “So far, I believe the procedures are being conducted fairly and hopefully we’ll have a fair outcome,” said Josh Eckert-Chu, whose son is a sixth-grader at the school.

Judge Paul Gardephe will rule on Wednesday whether to let the investigation proceed. The city’s Law Department declined to say what the penalty against Bloomberg might be if she is found to have broken any rules.