Attorney General William Barr on Tuesday ripped the FBI, asserting that the bureau may have acted in “bad faith” while investigating whether Donald Trump’s campaign colluded with Russia.

Barr, in an interview with NBC News, dismissed the findings by the Justice Department’s inspector general that the bureau wasn’t acting on political bias, and blamed the media for encouraging the probe.

“I think our nation was turned on its head for three years based on a completely bogus narrative that was largely fanned and hyped by a completely irresponsible press,” Barr said.

“I think there were gross abuses … and inexplicable behavior that is intolerable in the FBI. I think that leaves open the possibility that there was bad faith.”

Barr also told the network that the prosecutor he tapped to launch another probe of the investigation, Connecticut US Attorney John Durham, would have the final say when his own international investigation was completed.

Inspector General Michael Horowitz concluded in a report released Monday that he “did not find documentary or testimonial evidence that political bias or improper motivation influenced the decisions to open” the probes into the Trump campaign.

But Barr dismissed the IG’s report as a half-hearted, incomplete effort — rebuking a top official in his own department.

“All he said was, people gave me an explanation and I didn’t find anything to contradict it … he hasn’t decided the issue of improper motive. I think we have to wait until the full investigation is done,” Barr said.

Barr also said he stood by his claim that the Trump campaign was spied on because the feds used informants who recorded conversations with campaign officials.

“It was clearly spied upon,” he said. “That’s what electronic surveillance is … going through people’s emails, wiring people up.”

And Barr described the entire Russia probe as bogus from start to finish.

“From a civil liberties standpoint, the greatest danger to our free system is that the incumbent government use the apparatus of the state … both to spy on political opponents but also to use them in a way that could affect the outcome of an election,” Barr said, telling the network that it was the first time that “counterintelligence techniques” had been used against a presidential campaign.

Barr’s comments came hours after Trump ripped FBI Director Christopher Wray on Twitter, pointedly noting that he was the “current” top G-man.

“I don’t know what report current Director of the FBI Christopher Wray was reading, but it sure wasn’t the one given to me. With that kind of attitude, he will never be able to fix the FBI, which is badly broken despite having some of the greatest men & women working there!” the president said.

Wray succeeded James Comey, whom Trump fired in May 2017.