A controversial Brooklyn imam confirmed Thursday that the decomposing body of a young boy found in a squalid New Mexico compound is his grandson — but denied his mosque had anything to do with the death, or an alleged “conspiracy to commit school shootings.”

Authorities raided the remote desert compound on Friday, finding five adults and 11 kids living in squalor with a cache of guns.

Officials were searching for 3-year-old Abdul-Ghani Wahhaj, the disabled grandson of Brooklyn Muslim cleric Siraj Wahhaj.

Investigators did not find Abdul-Ghani, but they did discover the remains of a young boy.

Wahhaj said the corpse belongs to Abdul-Ghani.

“Whoever is responsible, then that person should be held accountable,” the 68-year-old said at his Masjid At-Taqwa in Bedford-Stuyvesant on Thursday.

Investigators ahve not officially identified the remains.

Authorities say Abdul-Ghani was abducted by his 40-year-old father Siraj Ibn Wahhaj — the cleric’s son — and brought to the compound for an exorcism.

The child was severely disabled and suffered from health problems including seizures, officials said.

Investigators also charged in court papers that the younger Siraj trained at least one of the 11 kids to use firearms as part of a “conspiracy to commit school shootings.”

When authorities raided the compound, he was found “heavily armed” with a loaded rifle, five 30-round magazines and four loaded pistols.

The imam admitted his son is “extreme” but denied he would kill anyone.

“My son can be maybe a little bit extreme,” the elder Siraj said. “High-strung.”

He also admitted that his son and one of his daughters had become “overly concerned” with people becoming “ possessed” lately — but the cleric claimed ignorance of the alleged terror plot.

“It sounds to me it sounds crazy. But I don’t know,” he said. “I make no judgments yet because we don’t know.”

Masjid At-Taqwea spokesman Ali Abdul-Karim Judan tried to explain away the guns and weapons training.

“Ibn Siraj has a license, he has a license to carry in 36 states,” the spokesman said in a video posted to Facebook Thursday.

“New Mexico is an open carry state like Georgia, Florida, Texas. So it’s not far-fetched, it’s not unusual for people to be carrying weapons and having weapons.”

The elder Siraj was an un-indicted co-conspirator in the 1993 World Trade Center bombings, and several people linked to the attack attended his mosque at the time.

All five adults arrested at the compound are related to the cleric — in Facebook posts, he has identified three of them as his children and the other two as in-laws.

But Abdul-Karim Judan denied the cleric is linked to the younger Siraj’s extreme behavior.

“[The media is] not focusing exclusively on the incident and the circumstances surrounding his son — they’re more or less castigating and slandering the imam,” he said.

Additional reporting by Faihaa Khan and Post wires