NEW YORK -- When Bruno Mars was in the studio crafting his upbeat, funky new album, he had a dress code: Wear your finest clothes, and leave your sloppy sweatpants at the door.

He said dressing up set to the mood so that he and his collaborators could write and produce groovy, smooth and soulful songs that make up “24K Magic,” his first album in four years.

“I made it a point: I’m showing up to the studio, we working, but I’m not showing up in sweats ‘cause you’re going to get what sweats sounds like,” Mars said. “So I’m going to wear every jewelry piece I collected, and my finest shoes, and write some songs.”

Get Breaking News Delivered to Your Inbox

His swag and style -- a curly, mini Afro, silky Versace shirt, classic shorts, slick shoes and a studded pinky ring -- match the sound of “24K Magic,” an epic ‘90s R&B-inspired album that plays like a cohesive jam session. It was released Friday.

Mars said the album was inspired by his love for R&B acts like New Edition, Boyz II Men and Jodeci as well as West Coast rap.

“The spirit of this album, growing up in the ‘90s, is to me the most joyous [time] for me. That’s my childhood. That’s what I grew up on,” he said. “I love DJ Quik, Suga Free, Too Short, E-40, Dr. Dre of course, Snoop, and that’s because these songs, they influenced hip-hop, these ‘70s funk songs, but it took place in the ‘90s and that’s why you had this soulful music with a superstar rapping on it. For me, it was all about the live show and the kind of party I want to throw.

“That is the spirit we were hoping to capture on this album, and that rhythm is not as popular on radio right now,” he added.

Mars says the trendy sound that some of his peers have adopted -- downbeat, alternative R&B -- isn’t him.

“See, when I grew up you had to know how to dance, that was the whole thing. Everybody danced -- thugs are dancing, the girls ain’t looking at you unless you’re dancing,” he said on a couch in the finely decorated and hip Atlantic Records office in New York. “I remember having so much fun growing up going to functions and dancing, having a good time. People see me and my band do what we do and I’m just trying to push that even now more so on this album than the last two. It’s like, ‘We got to be moving’ -- that’s it.”

Then he adds: “And I’m being mean about the R&B stuff. There’s room, it’s just not what I can bring to the table. It’s not what I want to do.”