A man engaged in a $400,000 extortion plot against a Brooklyn rabbi’s wealthy family paid a fraudulent witness to falsely claim that the rabbi had molested the witness as a child, prosecutors alleged Wednesday.

Samuel Kellner was awaiting arraignment on attempted larceny, perjury and other charges in a twisted case that has scandalized a tight-knit orthodox Jewish neighborhood and left the rabbi behind bars.

“Child abuse has to be prosecuted vigorously, but we also have to be careful about false complaints,” District Attorney Charles Hynes said in announcing the arrest.

An indictment alleges that Kellner learned in 2008 that a young man had accused the rabbi, Baruch Lebovits, of sex abuse. Kellner then cooked up a scheme to pay a second man $10,000 to lie and claim molestation as well, prosecutors allege.

Kellner, 49, also was charged with threatening to produce more alleged victims unless Lebovits’ family paid him $400,000. The rabbi owned a travel agency and his son is a successful businessman.

When the family refused to pay, Kellner allegedly persuaded a third young man to come forward. His story resulted in further charges against the rabbi.

The third victim testified last year at a trial where a jury found Lebovits guilty of committing criminal sexual acts. He was sentenced to the maximum prison term of about 10 1/2 year to 32 years.

Lebovits was expected to use the new development to seek bail and challenge his conviction. There was no immediate response to a phone message left with his attorney.

Prosecutors said Wednesday that they believe the original victim and third man who came forward were legitimate, and that they would fight an appeal. The second witness — the one Kellner is accused of paying — didn’t testify at the rabbi’s trial.

“We continue to support the conviction,” Hynes said.

If convicted, Kellner faces up to 21 years in prison. The name of his attorney was not immediately available.