A New Mexico judge granted bail Monday to five suspects — one the son of a controversial Brooklyn imam — who were accused of keeping kids in a filthy, heavily fortified compound.

Three women and two men, ages 35 to 40, will wear ankle monitors and be under house arrest if they can post $20,000 bond each, the judge ruled in Taos.

Deputy District Attorney Timothy Hasson told the court that the suspects were up to no good, saying, “This was not a camping trip and this was not a simple homestead of the kind that many people do in New Mexico.”

One of the suspects, Siraj Ibn Wahhaj, is the son of Brooklyn cleric Siraj Wahhaj, who has been linked to the 1993 World Trade Center bombing.

The body of a little boy was found last week at the compound, and the imam has said it was his 3-year-old grandson.