A Jewish man fired up by the Mideast conflict between Israel and Hamas nearly started a holy war of his own in Brooklyn — when he repeatedly drove his SUV draped with Israeli flags past a mosque while blaring Hebrew music and flashing strobe lights, cops said Friday.

Chaim Weiss, 20, was arrested by cops from the NYPD’s Hate Crimes Task Force for his stunt at the Islamic Society of Bay Ridge on July 20 during a 4 a.m. service for Ramadan, one of the most holy times of the year for Muslims.

The Borough Park man allegedly drove by the mosque several times, playing Israeli tunes so loud that those inside could hear him as they recited Koran verses, officials said.

Others who were worshiping outside because of an overflow crowd watched with outrage as Weiss cruised past.

“This Jewish guy was driving by looking at people praying,” said Sarah Eljadu, a congregant. “People were angry. Why was he playing music and hanging an Israeli flag? They are killing us.”

After cruising around like a parade float, Weiss allegedly parked his 2013 Honda Crosstour near the mosque with music blaring and multiple strobes flashing.

Angry Muslims shouted at him to go away, cops said.

Mohamed Elnashar, executive director of the mosque, told police he tried to recite passages from the Koran over the din but could not be heard.

Weiss sped off, only to return and make a few more passes by the crowd, cops say.

The worshipers eventually called cops and showed surveillance video of the prank.

The footage led cops to bust Weiss at the scene on misdemeanor charges of disruption or disturbance of a religious service and of disorderly conduct, court records say. He was not charged with a hate crime.

“Seven or more times this guy drove up and down the street during the prayer service blasting ­Israeli music with Israeli flags dotting the car,” an NYPD spokesman said.

Weiss knew that the neighborhood was predominantly Muslim — and admitted he hatched the plan to demonstrate “support for the Israeli people in Israel,” the complaint said.

A neighbor said of Weiss, “He’s young. Sometimes he does that type [of] stuff. He’s a fun-loving guy, but a little wild.”

A police source said cops decided to cuff Weiss and put him through the court system because of the blatant nature of the disruption of the Ramadan service, amid heavy fighting between Israel and Hamas.

Additional reporting by Jennifer Bain and Kenneth Garger