LAS VEGAS — As he recovers from his last big “Hangover,” Justin Bartha is preparing for another kind of debauchery in the upcoming film about the 1970s New York punk scene, “CBGB.”

Bartha appears next Thursday as Doug, the frequently kidnapped member of “The Wolfpack” in “The Hangover, Part III,” the final installment in director Todd Phillips’ enthusiastically raunchy comedy series co-starring Bradley Cooper, Ed Helms and Zach Galifianakis. Since Doug is the best-behaved of all the main characters, Bartha’s upcoming role as Stiv Bators, the notorious, hard-living and emaciated singer from the pioneering punk band Dead Boys, represents a wild stretch from his most recognized role.

“One of the things we love most about what we do is playing wildly different characters,” Bartha said during interviews at Caesars Palace in Las Vegas for “The Hangover, Part III.” “So yes, Stiv Bators is probably the opposite of Doug. You know, that’s the fun part. You get to lose weight for a part — there’s a lot of stuff I did. I’m a hairy guy and Stiv Bators wasn’t a hairy guy, so you can use your imagination on that. And then you get to be a rock star for a few weeks of your life.”

Legendary groupie/model Bebe Buell with Stiv Bators in the late-1970s.

Bartha, who recently completed one season on the NBC sitcom “The New Normal,” said he is a huge fan of the music that came out of CBGB, the lower Manhattan punk club that became the launchpad for an entire culture. The film, which will be released in late-2013, centers on the club’s owner, Hilly Kristal, played by Alan Rickman, and also features Malin Ackerman as Debbie Harry and Rickman’s “Harry Potter” co-star, Rupert Grint, as Dead Boys guitarist Cheetah Chrome.

“There’s a lot of great stuff to read about that time, and it’s one of the most amazing times,” Bartha said. “I have friends that played there and I used to go there, so it was the coolest thing ever.”

Securing the music rights for such a project can be challenging, since multiple labels and publishing companies are usually involved, and sometimes the original artists balk at how they are portrayed or their music is used. But Bartha said that “CBGB” was remarkably successful in securing rights to most of the major players — only one of the big names is missing.

“The music that came out of CBGB — for music fans, in my opinion — is the best music,” Bartha said. “And that movie got the rights to everything except the Ramones. But it works that they don’t have the rights to the Ramones.