Mets legend Dwight Gooden — who has openly battled decades-long drug and alcohol addictions that derailed his Hall of Fame dreams — was busted in New Jersey last month for cocaine possession and driving under the influence, according to court documents.

The June 7 arrest of the retired ace known as “Doc” is the latest in a sad saga that began during the peak of his stunning career in the 1980s.

The 1985 National League Cy Young Award winner led the Mets to their most recent World Series championship in 1986 — but fell into hard-partying ways.

He entered rehab in 1987 after testing positive for cocaine during Mets training camp.

In 1995, Gooden was suspended for the entire season for failing yet another drug test. His checkered past also includes busts for reckless driving, driving with a suspended license and battery for allegedly hitting his fiancée.

Gooden did an eight-month stint in jail for violating probation when he showed up high on cocaine to a meeting with his probation officer in 2006.

And then, in 2010, he was busted after crashing his car in Franklin Lakes, NJ, while under the influence of drugs — while taking his 5-year-old son, Dylan, to school.

In his most recent arrest, police in Holmdel pulled over Gooden, 54, just before 1 a.m. for driving too slowly on the highway, failure to maintain the lane and having overly tinted windows, which are illegal in the Garden State, Monmouth County Prosecutor’s Office spokesman Christopher Swendeman told The Post Friday.

Police allegedly found “two small green zip-lock style plastic baggies containing suspected cocaine” in his car, according to a criminal complaint.

Gooden, who was given a key to the city by Mayor Bill de Blasio in 2017, was charged with third-degree possession of a controlled dangerous substance, as well as possession of drug paraphernalia and being under the influence. He faces three to five years behind bars, if convicted.

He also was ticketed for driving under the influence, a municipal offense.

An initial court date has not yet been set, Swendeman said.

Gooden, who lives in Piscataway and is free pending his case, didn’t return a message, and his family declined to comment.

One of Gooden’s neighbors in his Middlesex County suburb, who declined to give her name, was shocked over the news.

“Really? He ain’t a kid anymore. When is he going to learn to fly right?” she said. “It’s sad, but he brought this on himself.”

As he weaved in and out of rehab through the decades, Gooden remained candid about his drug addiction — notably admitting in his 2013 autobiography, “Doc: A Memoir,” that he missed the 1986 Mets’ World Series ticker-tape parade in New York after going on an alcohol- and coke-fueled bender the night before.

In a previous interview with The Post, he hinted that his 50th birthday was bittersweet.

“I never thought I would make it to 50,” he said at the time. “I’ve been to rehabs. I’ve been to counseling. I’ve been to jail. I’ve been in prison. The only place I haven’t been yet is the cemetery. That would be my next stop.’’

He also spoke of facing his ­demons.

“I had to come to the conclusion that drug and alcohol addiction is a disease,” Gooden said in the same interview. “Part of being an athlete is you saying, ‘I got this. I can fix this.’ So in my mind, even though I’m struggling with this addiction, I know I can fix this, I don’t need help.’’

In 2016, he said he had been ­sober since entering rehab four years earlier.

“I have some health issues, but drugs is not one of them,” Gooden said.

Named the National League Rookie of the Year in 1984 at age 19, Gooden went 194-112 with a 3.51 ERA in his 16 major league seasons. He last pitched in 2000 for the Yankees — with whom in 1996 he threw his only no-hitter — before retiring.

The four-time All-Star fell well short of becoming a ­Cooperstown immortal, receiving just 3.3% in the Hall of Fame voting in 2006.

Gooden called his baseball career the best years of his life.

“On the baseball field, I have no regrets,” he told The Post in 2014.

Additional reporting by Lorena Mongelli