In a scene from a recent campaign ad, Democratic US Sen. Bob Menendez, casually dressed in a button-down shirt, open at the collar, walks through working-class Union City, NJ, where he grew up in a family of Cuban immigrants.

“I never forgot my roots,” says Menendez, 64, pointing a finger at the camera.

But the folksy part of the clip ends abruptly, interrupted with a blaring voice-over, dripping with sarcasm: “Is he kidding?”

The political commercial goes on to detail Menendez’s cozy relationship with a millionaire benefactor, flashing images of a private jet, clinking champagne glasses and sultry models — all scenes from a lavish, globe-trotting lifestyle a world away from the modest houses covered with aluminum siding and neat driveways of Menendez’s old neighborhood.

It’s one of a handful of negative TV spots paid for by a super PAC whose Web site, ShamelesslyCorruptMenendez.com, reminds voters that New Jersey’s embattled two-term senator faced a historic federal corruption trial in 2017, where he had been accused of accepting bribes from his friend Salomon Melgen in return for political favors for him and a bevy of beauties, with many of the details first revealed by The Post.

Now, a month from the Nov. 6 election, the long shadow of Menendez’s trial looms over the incumbent’s re-election campaign. A recent poll showed Menendez was viewed unfavorably by more than half of New Jersey’s eligible voters, and he led by only 2 percentage points against Republican foe Bob Hugin, 64.

This past week, a poll conducted by Stockton University found Menendez had 45 percent of the vote, compared with Hugin, a former pharmaceutical executive, who had 43 percent. Other polls last week showed Menendez opening wider leads, from 6 to 11 points.

But no matter what poll you choose, the fact that the Democratic incumbent in solidly blue New Jersey — where a Republican has not been elected to the US Senate since 1972 — even faces a serious challenge is nothing short of a miracle.

Hugin, a political neophyte and millionaire, is giving Menendez, a veteran politician first elected to public office as a 20-year-old in 1974, the run of his life.

“To the extent that this election has turned into a referendum on President Trump and in a state where Trump is not popular, you would think that an incumbent senator with a good legislative record would not have a problem getting elected,” said John Weingart, associate director of the Eagleton Institute of Politics at Rutgers University. “It just goes to show you the importance of Menendez’s corruption trial. It’s clearly influencing the vote.”

Bob Menendez met the man who would become his most important benefactor shortly after he was elected to the House of Representatives in 1993. Salomon Melgen, a prominent Florida ophthalmologist who grew up in the Dominican Republic, was well known as a deep-pocketed Democratic donor who often threw open his 6,500-square-foot North Palm Beach mansion for political fundraisers.

Melgen also owned a lavish home in Casa de Campo, a posh seaside town in the Dominican Republic, where his neighbors included fashion designer Oscar de la Renta.

At his sprawling, ranch-style villa, Melgen hosted Bill and Hillary Clinton, and their pal Terry McAuliffe, a former head of the Democratic National Committee, among other high-ranking Dems.

By the time he became a US senator in 2006, Menendez was also a frequent guest at Melgen’s home in the gated community, where beachfront villas cost as much as $20 million. The resort features three polo fields, 13 tennis courts, a spa, marina and three golf courses.

Both Melgen and his wife, Flor, began donating to Menendez’s campaigns, contributing more than $750,000 to the senator’s coffers during the course of their friendship. In addition to the campaign cash and frequent vacations at the doctor’s villa, Menendez, who is divorced, took a total of 19 flights on Melgen’s private jet and stayed at a five-star hotel in Paris paid for by the eye doctor, according to a 68-page federal indictment against the senator. And Melgen often brought along a guest on his luxury jaunts, court papers say.

In exchange for the contributions and gifts valued at more than $1 million, Menendez allegedly did favors for the doctor. He tried “to influence the outcome” of the government’s case seeking millions of dollars in Medicare over billings that Melgen owed them, the indictment charged. But in the strangest aspect of the case against Menendez, federal prosecutors charged the senator used his political muscle to build Melgen’s harem, ordering his staff to obtain visas for the married doctor’s girlfriends, referred to only as “Girlfriend 1, Girlfriend 2 and Girlfriend 3” in court papers.

In April 2015, The Post identified two of those women — a Brazilian actress who posed nude for Sexy magazine and a Ukrainian model/actress who wanted a plastic-surgery consult. Menendez also directed a staff member to “call Ambassador asap” in order to reverse a visa denial for a 22-year-old Dominican model, Rosiell Polanco, and her 18-year-old sister, the indictment says.

On July 24, 2008, Menendez directed his senior policy adviser, Mark Lopes, to e-mail a high-ranking official at the State Department to give “careful consideration” to the visa application of Juliana Lopes Leite, a Brazilian actress, lawyer and model who wanted to come to the US to study law at the University of Miami, according to the indictment.

“Sen Menendez would like to advocate unconditionally for Dr. Melgen and encourage careful consideration of [Lopes Leite’s] visa application.” The State Department responded within hours, and the next day Lopes Leite received her US visa in Brasília, court papers say.

Around the same time, Melgen was involved with Lopes Leite, he asked Menendez to intervene for another girlfriend, a Ukrainian model living in Spain.

“Dr. Melgen is a person of the highest caliber,” Menendez wrote in the February 2007 appeal to the State Department. “He is a fine citizen and held in high esteem by his peers.” A week later, Svitlana Buchyk got her visa and traveled to Florida, where she stayed in a Palm Beach apartment owned by Melgen. The doctor even introduced his lover to the senator, prosecutors said.

A year later, Menendez directed his staff to intervene with the US ambassador in the Dominican Republic to reverse the State Department’s decision not to issue a visa for two Dominican sisters, who were planning to spend Christmas with Melgen in Florida.

The doctor had previously written a letter to the US embassy in Santo Domingo assuring an official he would cover expenses for the sisters and that they would return home after their visit. He called Menendez the next day to “move the letter along,” according to court papers.

Menendez and Melgen were each hit with eight counts of bribery and three counts each of honest services fraud in the federal indictment. Also, Menendez, who has maintained his innocence throughout, was charged with a count of making false statements.

But at Menendez’s trial last year, prosecutors failed to convince jurors that the two men had engaged in a quid pro quo relationship. A mistrial was declared after jurors were deadlocked following four days of deliberations.

Still, the Senate Ethics Committee formally admonished Menendez, saying in a strongly worded letter in April that he broke federal law by accepting Melgen’s gifts.

“You failed to publicly disclose certain gifts as required by Senate Rule and federal law,” noted the letter. “Additionally, while accepting these gifts, you used your position as a member of the Senate to advance Dr. Melgen’s personal and business interests.”

The Senate panel also demanded that Menendez repay Melgen, although they did not specify an amount. Menendez has argued that he had already paid back Melgen in 2013 when he reimbursed him $58,500 for two flights on the doctor’s private jet.

For his part, Melgen, 64, was convicted in a separate federal trial last year on all 67 counts of defrauding Medicare of $73 million. Federal prosecutors showed he falsified patients’ files and submitted false claims. He also gave his elderly patients unnecessary, painful eye injections and tests for diseases they didn’t have.

While Melgen is currently serving a 17-year sentence at a Miami-area prison, Menendez is enduring his own punishment at the hands of New Jersey voters, and is desperately trying to hang onto his Senate seat. “US senators don’t normally get this much publicity, but the charges of corruption and the trial have dominated New Jersey for the last five years,” said Weingart.

That obsession just might propel Hugin to Washington. But it’s a bitterly fought race in which Menendez’s supporters have launched their own attack ads, blaming Hugin’s former drug company, Celgene, for inflating the price of life-saving cancer drugs and using the profits to bankroll his political campaign.

“With each passing day, corrupt, career politician Bob Menendez loses support from New Jerseyans who have had enough of his dishonesty,” Hugin told The Post. “He has failed to accomplish anything for New Jersey during his 25 years in Washington, so he has to resort to lies and cheap political attacks instead of running on his record. But I guess when your shameful record led to the Obama Justice Department believing you belonged in jail, you’ll say or do anything to save your political career.”

Menendez would not comment for this story.