A Brooklyn judge ordered prosecutors Monday to produce a mysterious confidential informant who NYPD cops are accused of inventing – possibly as part of a broad scheme to boost their number of gun busts by planting firearms on innocent men.

Defendant Jeffrey Herring, 52, is among at least six men arrested since 2007 with the help of “informants’’ who the arresting cops from the 67th Precinct in East Flatbush didn’t produce in court, his lawyer said.

“These are officers who are lying, and innocent people were brought to court,” defense lawyer Debbie Silberman said, adding that two separate judges have ordered prosecutors to produce the informant in Herring’s case.

Prosecutors said Monday they had found the confidential informant in Herring’s case but needed more time to investigate his arrest.

Brooklyn Supreme Court Judge Dineen Riviezzo adjourned the case until Jan. 15 but told prosecutors that at that date they would be required to either produce the informant or resolve the case.

“I suspected they would produce some confidential informant, because if they didn’t, it would show they were lying with the other five cases,” said Eugene Moore, who was arrested in 2012 by the same team of cops but had his case dismissed when a judge called the detective’s testimony “incredible,” court papers state.

The 67th Precinct cops said they arrested Moore after a tip from a confidential informant – but never put the existence of the informant in any of their paperwork, court papers state.

Herring did not appear in court Monday.

“The patently incredible police observations and account of Mr. Herring’s arrest, the team’s inexplicable failure to conduct any follow-up investigation into a recovered (and handled) illegal firearm, and their inability to substantiate the existence of their claimed CI … all render the police account, upon which the entire prosecution of Mr. Herring is founded, inherently unreliable,” Silberman wrote in court papers.

Two other men arrested by the same team of 67th Precinct cops were collared after mysterious confidential informants told the cops they had guns.

One of the men pleaded guilty before his trial started in exchange for a sentence of time served. The other won a $115,000 settlement from the city after he sued in federal court over the arrest and the judge found that the team’s lieutenant had committed perjury, court papers state.

Silberman said in court Monday that she had located two other gun arrests with the same allegations of misconduct against the 67th Precinct team – bringing the total number of allegedly shady cases to six.

“The [Herring] case, as well as [two others], all involve the implausible allegation that a black male, standing on a busy street in an area of East Flatbush crawling with police, chose to brazenly display a firearm at the exact moment the team first observed the suspect, without the suspect first observing the team,” Silberman wrote in court papers.

“Apparently these officers are so effective that there is no need to search for weapons – the weapons find them.”

Court papers state that while Herring’s defense has no proof of the team’s motivation for fabricating gun raps, pressure from the NYPD to meet “quotas” or “performance goals” was present during the time of the arrests.

A NYPD spokeswoman said Internal Affairs is probing the cops’ behavior in these arrests.

“Any allegations that are made in regards to the credibility” of the officers “are taken very seriously,” Deputy Chief Kim Y. Royster said in a statement to the Post.