A man showed up at a Jewish school in Queens armed with a hammer Tuesday morning, broke free of the security guards who had grabbed him and then assaulted an 8-year-old boy, police sources said.

The boy was shoved into a metal fence, cutting his head. He was not seriously injured. The 42-year-old attacker was arrested.

The incident happened about 10:50 a.m. at the Jewish Institute of Queens on Woodhaven Blvd. in Woodhaven.

The episode appears to have started when the man accosted a woman up the block, who headed toward the school. Security officers saw the woman was in distress and tried to assist her, sources said. Security was able to stop him and take the hammer away, but he fought back, broke free and attacked the boy outside the school building.

A hate crime is not suspected at this time.

The attack comes just days after a man shouting “Allahu Akbar” stabbed an Asian man and a Jewish man in back-to-back broad-daylight attacks on the Upper West Side. The assailant, Raul Morales, is facing up to 40 years in prison for his violent hate crime spree, prosecutors said Saturday.