Credit-card fraudsters with ties to a hip-hop group that has a song titled “For A Scammer” spent months ripping off Manhattan’s toniest stores, sources said Tuesday.

Art apparently imitated life for the Brooklyn-based rappers — dubbed the “Pop Out Boyz” — after a yearlong investigation by the NYPD’s Financial Crimes Task Force and Manhattan District Attorney’s Office’s Cybercrime and Identity Theft Bureau led to the arrests of 39 affiliates and members this week, sources said.

Officials said that between May 2015 and April 2016, the defendants used stolen credit card information to make more than 200 purchases — ringing up approximately $258,000 at Barneys alone.

They also shopped at Saks Fifth Avenue and unsuccessfully tried to purchase $156,000 in goods and merchandise throughout the year as well.

Sources told The Post that the fraud operation ultimately fueled the group’s rap career.

In their song “For A Scammer,” which is posted to SoundCloud, the Pop Out Boyz can even be heard flaunting the spoils of their success.

“Watch the money do a backflip, early morning up at Saks Fifth, you see it you want it you have it … I just a hit a lick now I’m dabbin,” one of the rappers says.

Another repeatedly brags, “I’m cracking cards cause I’m a scammer” — seemingly referring to a new credit card scheme known as “card cracking.”

According to the American Bankers Association, the scam involves contacting a person through social media and letting criminals deposit phony checks into their bank accounts in exchange for a small cut of the illicit profits. But instead of paying up, the crooks typically remove all of their funds before the bank can determine that the check is counterfeit.

By the time the victim realizes the deposit is a fake, it’s too late — and they are left on the hook for any money that was withdrawn.

The suspects were rounded up Tuesday morning and hauled into Manhattan Supreme Court, where they were charged with grand larceny, criminal possession of a forged instrument, conspiracy, and criminal possession of stolen property, among other counts.

“As alleged, the members of this identity theft ring exploited stolen personal information to manufacture fake credit cards,” explained Police Commissioner Bill Bratton.

“With the forged instruments, the defendants shopped in Manhattan’s most high-end retail stores, all on someone else’s dime.”

Additional reporting by Emily Saul