Conor McGregor scored a sweetheart plea deal Thursday, copping to disorderly conduct charges — and dodging jail — for his epic meltdown in Brooklyn that left MMA fighters with injuries.

The Irish brawler and his teammate Cian Cowley both received conditional discharges — meaning they must stay out of trouble for a year — for the April fiasco at the Barclays Center.

Both men were ordered to perform community service and attend an anger management program.

Disorderly conduct is a violation and not a crime.

“You’re in fact guilty of that charge?” Brooklyn Supreme Court Judge Raymond Rodriguez asked them.

They each replied, “Yes.”

Asked if he wanted to address the court, McGregor declined.

The pair had initially faced felony counts including criminal mischief, assault and reckless endangerment.

McGregor was caught on tape chucking a metal hand truck at a busload of grapplers after a press conference hyping a UFC fight.

Fighters Michael Chiesa and Raymond Borg were injured by flying glass — and saw their bouts canceled.

McGregor also was charged with pummeling Jason Ledbetter. He was freed and allowed to return to home after posting $50,000 bail put up by celebrity bondsman Ira Judelson.

Orders of protection were issued for each of the three men, barring McGregor from coming into contact with them — or else face 15 days in jail. He also was ordered to pay restitution to them but the amount wasn’t put on the record.

McGregor, who had faced up to seven years behind bars, was pleased with the resolution.

“Thank you to the District Attorney’s Office for allowing me to move forward,” McGregor told a crowd of fans and media outside the courthouse after the hearing. “I want to say thank you to my friends, family and my fans for allowing me to move forward.”

His lawyer, Bruce Maffeo, insisted the outcome wasn’t special treatment.

“We appreciate that this is the same outcome that would have occurred had he been a non-celebrity,” he said.

Maffeo added that McGregor’s immigration status wouldn’t be affected, “which quite frankly was a factor in the DA’s decision.”

A Brooklyn DA spokesman said the plea deal was a win-win.

“This is a fair resolution that holds the defendant accountable, ensures restitution for the victims and requires the defendant to perform community service where he can reflect on his conduct and give back to society,” he said.