A veteran architect and professor at the Pratt Institute was busted after firefighters found kiddie porn hidden while battling a blaze at the Jersey shore home he designed for himself, authorities said.

Gamal El-Zoghby, 75, faces a single count of endangering the welfare of children after the creepy discovery Tuesday in Eagleswood Township.

Someone called 911 shortly before noon reporting smoke pouring from the distinctive, red modern home overlooking Little Egg Harbor.

Six local fire departments responded and tried to cut holes into the roof so they could shoot a fire-suppressing foam inside.

But they were hampered by a thin layer of steel built into the home to protect it against hurricanes and tropical storms.

When they knocked down a wall to get access to the ceiling, a stash of pornographic images literally fell on top of them, sources said.

No one was home at the time of the fire, which remains under investigation.

El-Zoghby was busted several hours later at a nearby State Police barracks after he was questioned about the blaze.

Reached at his apartment on the Upper West Side, El-Zoghby yesterday denied that he owned child pornography, insisting the images were girlie magazines he bought on 42nd Street in the 1970s.

“They are 45, 50 years old, old paper magazines with images of women 16 and older,” he said.

“I never got rid of them. It was so stupid, and now I am paying the price.”

But cops weren’t buying it.

“Firefighters discovered one magazine that contained images of child pornography – pictures of juvenile females,” said New Jersey State Police Lt. Stephen Jones.

A spokeswoman at Pratt, the Brooklyn college where El-Zoghby has taught since 1969, said he “is on a leave of absence while the Institute’s Department of Human Resources investigates the matter. “ rfredericks@nypost.com