A randy Brooklyn judge turned the hallowed halls of justice into a seedy sleaze pit — sexually harassing his Orthodox Jewish secretary with lurid tales about his erotic adventures with a mistress, proudly striding shirtless around his chambers, and forcing her to pick up his soiled underwear, a new lawsuit charges.

Brooklyn civil court Judge David Schmidt, 61, tormented veteran court secretary Sharon Sabbagh, 57, by stroking her face, forcing her to give him hugs before she went home, and regaling her with explicit tales of sex with his mistress, the lawsuit alleges.

“When I have sex with my wife, I think of her,” Schmidt said, adding that he buys his fling underwear from Victoria’s Secret and that they have daily phone sex, the Brooklyn Supreme Court suit claims.

“When she sits across from me, she sits with her legs open so I can see her crotch, she wouldn’t do that if she didn’t want me,” the judge allegedly told his secretary.

The modest Sabbagh, a court secretary for 24 years, says the judge canned her in January — the day after she complained about his behavior to administrators.

Schmidt — who was elected to the bench in 1995 — also forced Sabbagh to print out his email from an online dating site, look at a handwritten “sex poem” he wrote to his mistress, and made fun of her religious head covering, according to the lawsuit.

“I’m extremely sad and hurt that I lost my job with the court system because of my complaints about how Judge Schmidt dehumanized me, even though everyone who worked with me knows what he’s like and how he treated me,” Sabbagh told The Post through her lawyer, Jack Tuckner.

“I’m embarrassed to have to bring this lawsuit, but what else could I do? No one deserves to be treated this way, especially by judges who are supposed to uphold the state’s human rights laws.”

Sabbagh complained about Schmidt’s bawdy behavior to a judge on the court’s anti-discrimination panel in 2013 but got no help — and when she told the court’s top judge about the harassment, the judge told Schmidt and she was fired the next day, the lawsuit states.

“Bringing this lawsuit was a last resort for Sharon, as she’s a deeply religious woman and this is a humiliating process for her,” said Tuckner.

“Ew, that’s an ugly sheitel, I hate it,” the cruel judge told her loudly in a crowded courtroom, the suit states. A sheitel is a type of wig worn by some married women to conform with Jewish law.

The suit names Schmidt, the state Office of Court Administration, the state, and the two other judges to whom Sabbagh complained.

A spokesman for OCA declined to comment on active litigation.

Schmidt refused to comment on his ex-secretary’s allegations when he got home from court Thursday night.

“My lawyer will make the comment,” he said, but declined to give his lawyer’s name.

Additional reporting by Priscilla DeGregory