A prominent Brooklyn rabbi was charged yesterday with molesting a 12-year-old girl over three years, authorities said.

Nechemya Weberman, 52, of Williamsburg, pleaded innocent at his arraignment last night. Authorities said the shocking sex abuse, took place from 2007 until 2010.

The alleged victim — who was being counseled by the rabbi, a source said — is now 16. The source said her parents contacted police.

Police said Weberman was charged with a criminal sex act, rape, endangering the welfare of a child and sexual abuse.

“When someone is a molester . . . it has to be dealt with,” said Assemblyman Dov Hikind (D-Brooklyn), who represents the predominantly Jewish Orthodox community of Borough Park.

“We have made some progress [in the community], but we have a very long way to go. Now is the time to stand up and do the right thing.”

Weberman’s lawyer, George A. Farkas, denied the charges, saying his client “has counseled troubled families in the past.”

“It would be an injustice if people had any kind of belief that there was truth in these allegations,” he said.