The Brooklyn DA and NYPD Internal Affairs are investigating cops caught on tape beating a man wrongly suspected of trespassing in a Crown Heights synagogue, authorities said yesterday.

The Oct. 8 beatdown took place at the Alternative Learning Institute for Young Adults, a synagogue and outreach center for troubled youths.

Cops believed that Ehud Halevy, 21, was homeless and trespassing.

A volunteer security guard mistakenly called police, not knowing Halevy had been staying there for about a month, with permission.

NYPD spokesman Paul Browne said one of the cops involved, a 49-year-old man, “has been placed on modified assignment.”

A source said, “The Brooklyn DA is looking at the tape and investigating the circumstances of the arrest.”

When cops first approached, Halevy, not wearing a shirt or pants, refused to leave.

“You’re not kicking me out — I have a right to stay here,” he insisted according to law-enforcement sources.

Halevy put on his pants before the confrontation escalated to the incident caught on tape.

He was booked for assault, obstructing governmental administration, criminal trespassing, resisting arrest, harassment and pot possession.

“He [Halevy] was in a needy position. He needed a place to sleep,” said Rabbi Moshe Feiglin, who runs the center.

Several politicians said cops went overboard in using force.

“When we watched the video and saw some of New York’s Finest behaving in a not very fine way, brutalizing an individual for absolutely no reason, it was just something horrible,” said Brooklyn Assemblyman Dov Hikind.

The volunteer security guard, 24-year-old Zalmy Trappler, said he regrets calling cops on Halevy.

“He was sleeping naked on the couch, so I told him to leave. I said, ‘You have five minutes to leave,’ and he said, ‘If you don’t leave, I’ll kick your ass,'” Trappler said.

“I deeply regret calling the police. When I saw the video, I got emotional — I felt like it could have been avoided. If I knew it would have gone that way, I never would have made the call.”

Trappler said he and Havely have made their peace since the incident happened.

Additional reporting by Josh Saul and David K. Li