The joke was on Ashton Kutcher and MTV’s prank show “Punk’d” when they staged a mock arrest of the hiphop group The Black Eyed Peas at a phony brothel — and the rappers’ entourage started punching out the pretend police!

One friend of a band member slugged an off-duty cop hired to lend authenticity to the raid and another actor was tackled and knocked into the swimming pool.

“The masterminds at ‘Punk’d’ will think twice before they try to pull another prank on The Black Eyed Peas!” said an insider.

PARTY TIME

The practical joke started innocently enough with the Peas being invited to a party at a Hollywood Hills mansion.

But when group members, with the offbeat names will.i.am, apl.de.ap and Taboo, arrived they saw couples retiring to bedrooms in the mansion.

Just as the “Punk’d” pranksters planned, the Peas and their entourage found themselves in the middle of a brothel party with high-priced call girls.

SUSPICIOUS

“Band member will.i.am was an accomplice in the prank,” said an eyewitness. “But the rest of the band and their entourage became suspicious.”

Just then a team of seven phony vice cops rushed in from all directions. Some of the band members tried to explain it was a big misunderstanding, but the Peas’ pleas fell on deaf ears.

MUSICAL MELEE

And then all hell broke lose.

“When one of the cops acted like he was going to slap the cuffs on will.i.am, one of his friends punched a cop in the jaw, which sent him flying backwards and into the pool,” said the eyewitness.

“Then, the guy tackled another one of the prop-cops and they both went tumbling into the pool!”

The “Punk’d” crew members hurriedly tried to explain that it was just a joke — but nobody was laughing.

ABSENT ASHTON

Usually at this point Ashton comes out of hiding and lets the celebrity in on the prank, but a spokesman said the actor was away on location for a movie.

It’s just as well. The Black Eyed Peas quickly left because tensions were so high, said the eyewitness.

“If they had stayed, it probably would have led to a full-fledged brawl between the band and the ‘Punk’d’ crew.”