Like moths to a flame, two FDNY firefighters kept gawking too close to a raging New Jersey fire recently — and got arrested for it.

Matthew Paglione and Matthew Farletta were collared Feb. 2 at the scene of a three-alarm, multi-house blaze in Trenton after they repeatedly defied orders to stay behind police tape, officials said.

“They were advised multiple times to stay out of the perimeter that that had been set up,” Trenton Det. Capt. Stephen Varn told The Post.

“Apparently they got back into the scene one last time. At that point, they were advised they were under arrest.”

Paglione and Farletta were charged with “failure to disperse,” Varn said. He had no explanation for the disobedience.

But police believe the two were “intoxicated,” said Trenton city spokesman Connor Ilchert. No alcohol blood tests were conducted.

Both were taken into custody and issued summonses with a date to appear in court, he said.

A Philadelphia TV station reported, “two men claiming to be firefighters were arrested at the scene of a 3-alarm fire” that engulfed several homes.

The FDNY confirmed Paglione, 41, is a 16-year FDNY veteran, stationed at Ladder 27 in The Bronx; Farletta, 35, is a 13-year member of Squad 61 in The Bronx.

While the FDNY typically suspends members for up to 30 days without pay after an arrest, it did not remove Paglione and Farletta.

“There are no allegations at this time which would warrant a suspension,” FDNY spokesman Frank Dwyer said in an email.

He added, “When the summons cases from NJ are adjudicated, the Department will be able to commence potential disciplinary actions depending on the outcome of that case.”

A veteran FDNY insider said he wasn’t surprised by the light treatment. “Welcome to the new FDNY, where you break the law and the department no longer suspends you. There is no discipline at FDNY any more.”

Paglione and Farletta could not be reached for comment. After The Post asked the FDNY about the arrests, both firefighters took down their Facebook pages. In one photo, the two were identified as cousins.