A Brooklyn federal court judge unleashed her wrath Wednesday on a defense attorney for victim blaming, before sentencing her Bonanno-capo client to 14 years behind bars for a loansharking scheme that terrorized a Queens neighborhood for nearly 20 years.

Defense attorney Elizabeth Macedonio invoked the fury of Chief Judge Dora Irizarry as she attempted to plead for leniency for Ronald Giallanzo, by saying some of the extortion victims knew what they were getting into.

“That’s like saying a prostitute who is out there selling her body might get raped, but what’s the difference,” the judge said with rage in her voice. “As they say, ‘you sleep with dogs, you get fleas.’ But that doesn’t excuse the offense.”

Irizarry also likened Giallanzo, the nephew of notorious Bonanno capo Vincent Asaro — who the feds have claimed was the mastermind behind the notorious Lufthansa air cargo heist depicted in “Goodfellas” — to “Dr. Jekyll and Mr. Hyde.”

“You threatened to have people beaten with bats, you had them beaten with pipes, it’s like in the movies. But this isn’t a movie,” she said.

Giallanzo and a gaggle of cohorts were arrested in March 2017 on charges of racketeering, kidnapping, robbery, attempted murder and other counts.

Prosecutors said the 48-year-old acting capo ran a gambling ring and extortion racket in Howard Beach that spanned from 1998 — and multiple stints behind bars for Giallanzo — to his arrest in 2017.

In one instance, Giallanzo and an unidentified associate dragged a victim into a car and beat the man until he soiled himself, while the wiseguy screamed, “Where’s the f–king money?”

Giallanzo, nicknamed “Ronnie G,” pleaded guilty to racketeering conspiracy in March, and admitted to extorting five different people. On Wednesday, he told the court he would likely miss the marriages of his children and the deaths of his parents, saying, “I can blame no one but myself.”

Meanwhile, prosecutor Lindsay Gerdes called him a “puppeteer,” who despite prison time hadn’t learned his lesson.

She also accused him of trotting out his hands-on work at Ground Zero, which left him with cancer, as a ploy for sympathy whenever he got into trouble.

“He argued the same thing before,” Gerdes said. “When does time wash that out?”

While Irizarry acknowledged the “good” the mobster did after Sept. 11, she agreed “there should have been a point of reckoning,” before citing that he’d risen within the ranks of the Bonanno family following his first prison sentence.

“I have to wonder, what does it take,” she said. “I don’t know you can pull away from this, Mr. Giallanzo. I think it’s ingrained in who you are.”

She then offered a warning to his four children before imposing her sentence, softly saying: “It is better to live a humble life than one spent constantly looking over your shoulder.”

Though federal sentencing guidelines recommended Giallanzo land at most just over seven years prison, she slapped him with 12 years. She also imposed two more years for violating his supervised release.

As sobbing kin fled the gallery, the red-faced man turned toward the remaining loved ones and mouthed “I’m sorry.”

As part of the sentence, Giallanzo was also forced to forfeit $1.25 million and sell the Howard Beach mansion he built with his ill-gotten gains. He also owes $268,000 in restitution to five loansharking victims.

The sprawling home is still on the market, Macedonio told reporters, saying the proceeds from the home would cover restitution in addition to forfeiture.

“It was excessive,” the defense attorney said as she left. “We’ll certainly be pursing his right to appeal.”

Giallanzo’s family and friends declined to comment as they left court, tears still streaming down their cheeks.