A controversial Brooklyn rabbi was busted yesterday for allegedly pocketing $3.25 million in checks after shaking down a hedge-fund firm with phony charges of insider trading.

Milton Balkany is accused of trying to blackmail the firm by saying that the feds were “thirsty” to nail its manager, but that he himself didn’t want the manager hurt because they were “co-religionists.”

Balkany allegedly claimed that a prison inmate he was counseling could blow the whistle on illegal stock trades because he had formerly worked at the fund.

But Balkany, the 63-year-old dean of the Bais Yaakov girls’ school in Borough Park, promised to keep the inmate quiet for $4 million in payments to Bais Yaakov and another religious school, according to a Manhattan federal-court complaint.

“I don’t consider it a lot of money,” Balkany allegedly told the hedge fund’s lawyers during a conversation secretly recorded last month.

Authorities had been tipped to Balkany’s scheme by the fund, the legal papers said.

Balkany — once dubbed “the Brooklyn bundler” for rounding up big-bucks political donations to Rudy Giuliani, George Pataki and Bob Dole — also allegedly boasted of government connections that could help the hedge fund down the road.

But the high-stakes scheme ground to a halt yesterday after one of the lawyers, during a meeting in Manhattan, handed over two checks intentionally written on a closed account, according to the court papers.

Balkany allegedly tried to deposit the money into an account he opened yesterday in Borough Park, then desperately called the lawyer to arrange for a wire transfer when the checks wouldn’t clear.

He was arrested on charges including wire fraud, extortion and blackmail. He appeared in court and was released on a $250,000 bond.

Balkany gained notoriety in 2003 after he was charged with misappropriating $700,000 in government grants. Charges were dropped after he repaid the money.

On his way out of court last night, he predicted prosecutors will again back off and called himself “an innocent man” — as two supporters held umbrellas in front of him and scuffled with photographers taking his picture.