On the 2008 campaign trail, Barack Obama was a rock star. Three years later, he’s more of a superfan.

Aretha Franklin sang at his inauguration, and he’s plucked faces off the Mount Rushmore of rock-and-roll to perform at the White House — Bob Dylan, Paul McCart
ney and Stevie Wonder among them.

The White House’s latest musical tie? A peppy new music video that Beyonce has made for first lady Michelle Obama’s “Let’s Move!” campaign against childhood obesity. In the video, the 29-year-old R&B superstar coaches a group of students through a dance routine that’s heavy on the cardio.

A White House spokesman said that the first lady and her team weren’t involved in the making of the clip but that Beyonce is “a great example of how people can get involved with ‘Let’s Move!’ and bring this message to more and more young people.”

Although the video will be shown at schools across the country, it raises an issue that extends beyond tweenage fitness: With a reelection campaign fast approaching, the president will have to find ways to reenergize a young, disillusioned base. Will his continued associations with the artists that fill his iPod (and ours) help do the trick?

It depends who you ask. Perhaps not surprisingly, the answers fall along party lines.

Former Republican National Committee spokesman Doug Heye said pop-star endorsements don’t help the president. “Will.I.Am had celebrities tripping over themselves to be a part of that video,” Heye said of “Yes We Can,” the star-studded 2008 clip that set an Obama campaign speech to music. “But you can’t pinpoint when and how that helped Obama.”

Heye also sees the White House’s warm and frequent embrace of popular music as a negative — and occasionally ill-timed. “Obama on stage with Paul McCartney singing ‘Hey Jude’ is not what voters wanted to see when oil was spilling into the gulf,” Heye said of McCartney’s performa nce at 1600 Pennsylvania Ave. in June, weeks after the BP oil spill.

But Hans Riemer, the youth-vote coordinator for Obama’s 2008 presidential campaign, said the president’s links to music and culture helped “put energy into the grass roots” of his campaign and, today, keep him connected to the young people who voted him into office.

“He’s the president of a new generation,” Riemer said. “He’s closer to their worldview than anyone else that has ever been able to hold the office of the presidency.”

Numerous musicians have visited the White House during the president’s first term, including Justin Bieber, Smokey Robinson, Foo Fighters, Joan Baez, Common, John Legend, Branford Marsalis, Emmylou Harris, Alicia Keys, Sheryl Crow, Herbie Hancock, Marc Anthony, Jennifer Lopez, Elvis Costello, the Jonas Brothers and Los Lobos.

In 2010, Beyonce made a casual White House visit with her husband, rapper Jay-Z, and sang at a state dinner a couple of months later. But her new music video finds her not just supporting the Obamas but getting behind an actual policy initiative.

Uploaded to YouTube on Tuesday, the clip starts with the singer bounding into a school cafeteria wearing an outfit that in many schools would get her sent to the principal’s office: short-shorts, knee-high socks and stiletto heels — which, honestly, probably build more muscle than a pair of Shape-ups.

Then the patty-caking beat of her 2007 hit single “Get Me Bodied” kicks in, and the singer begins tweaking the lyrics, adapting them to the first lady’s fitness agenda by encouraging kids to run, dance and jump-rope all while guiding them through a nonstop dance routine. “A little sweat ain’t never hurt nobody,” she sings, with nary a bead of perspiration on her brow.

It’s big fun as the song ramps up, and it only gets more interesting as the song winds down. “Run to the left, to the left . . . Run back to the right, to the right,” Beyonce sings — perhaps coded campaign advice.

But it all ends with a dance move that’s distinctly bipartisan: “Wave the American flag.”