Tom Brady won the Deflategate court battle on Thursday — and NFL commissioner Roger Goodell took another hit when the federal judge bashed him for “dispensing his own brand of industrial justice.”

Manhattan federal Judge Richard Berman overturned Goodell’s four-game suspension of Brady over his alleged role in the use of under-inflated footballs during the AFC Championship Game in January.

Berman’s ruling clears the way for Brady to play in the Patriots’ season opener Sept. 10 against the Steelers. Goodell announced Thursday afternoon he would not attend that game so the focus could stay on the field.

The NFL immediately announced it will appeal Berman’s decision but did not pursue a stay on the judgment while the appeals process plays out.

“We are grateful to Judge Berman for hearing this matter, but respectfully disagree with today’s decision,” Goodell said in a statement. “We will appeal today’s ruling in order to uphold the collectively bargained responsibility to protect the integrity of the game.

“The commissioner’s responsibility to secure the competitive fairness of our game is a paramount principle, and the league and our 32 clubs will continue to pursue a path to that end,” Goodell added. “While the legal phase of this process continues, we look forward to focusing on football and the opening of ​​the regular season.”

Patriots owner Robert Kraft gleefully said his franchise icon deserved this win.

“As I have said during this process and throughout his Patriots career, Tom Brady is a classy person of the highest integrity. He represents everything that is great about this game and this league,” Kraft said in a statement.

Deflategate suspension tossed

“Judge Richard Berman understood this and we are greatly appreciative of his thoughtful decision that was delivered today. Now, we can return our focus to the game on the field.”

Bill Belichick chose not to discuss the case after Thursday’s preseason game against the Giants.

“I’ll just talk about the game,” the Patriots coach told reporters.

Berman heard the three-time Super Bowl MVP’s appeal and was forced to make the final call after Brady’s reps and the NFL couldn’t reach a settlement.

In his 40-page decision, the judge said his ruling is based on three “significant legal deficiencies” in the NFL’s disciplinary process: The lack of advance notice Brady could be suspended for ball tampering or less-than-full cooperation with the investigation; the quarterback was not allowed to examine NFL general counsel Jeff Pash, one of the lead investigators who probed the case; and Brady was denied equal access to investigative files such as witness interview notes.

“Because there was no notice of a four-game suspension in the circumstances presented here, Commissioner Goodell may be said to have ‘dispense[d] his own brand of industrial justice,’ ” Berman wrote.

The judge also bolded the portion of his decision that said the Wells Report acknowledged that “our scientific consultants informed you that the data alone did not provide a basis for them to determine with absolute certainty whether or not there was tampering.”

Berman bashed the NFL’s disciplining Brady by using the broad policy banning “conduct detrimental” to the game, calling it “legally misplaced.” He even cited the cases of Ray Rice and Adrian Peterson, who he said were disciplined not for “conduct detrimental” but for specific policies banning domestic violence.

The NFL Players Association praised the decision.

“This decision should prove, once and for all, that our Collective Bargaining Agreement does not grant this Commissioner the authority to be unfair, arbitrary and misleading,” the union said in a statement.

The NFL fined the Patriots a league-record $1 million and docked them a 2016 first-round draft pick and a 2017 fourth-round choice over Deflategate, and those punishments will stand because Kraft said he wouldn’t appeal.

Shortly after the decision, the Patriots posted on Twitter a photo of Brady pumping his fist.

Attorney Matthew Cantor of the firm Constantine Cannon said it will be difficult for the NFL to get its appeal heard quickly. The median appeal in the Second Circuit Court of Appeals lasts 10 months, according to court records, and just 7.5 percent of decisions are reversed.

“If the case is not expedited, the appeal will most likely be heard and decided after the next Super Bowl,” Cantor said.

In a hearing last month, Berman sharply questioned NFL attorney Daniel Nash about whether there was any direct evidence linking Brady to the deflated footballs.

Under-inflated footballs are considered easier for players on offense to handle, throw and catch. Each team provides its own footballs when its side is on offense or kicking.

“Is there a text in which Mr. Brady instructs someone to put a needle in a football? No, there is not such direct evidence,” said Nash, adding later, “Just because there may not be a smoking gun does not mean there’s not evidence of culpability.”

Berman appeared to telegraph his doubts that Brady gained any real edge in using deflated footballs.

When refs figured out the Patriots were using under-inflated balls on offense, New England led the Colts 17-7 at halftime of the AFC title game on Jan. 18. But with the properly inflated footballs, New England went on to its 45-7 romp. The Pats won Super Bowl XLIX two weeks later, defeating the Seahawks 28-24.

“You might say [Brady] got no better advantage from the under-inflation,” Berman said.

He even seemed to dismiss the whole controversy at one point.

“This Deflategate,” Berman cracked. “I’m not sure where the ‘gate’ comes from.”