Mayor Michael Bloomberg said today the traditional “perp walk” — when cops parade those arrested before the media — is unfortunate, but also said the best way to avoid one is not to commit crime.

Bloomberg, in Albany today to lobby for same-sex marriage legalization, responded to a question about the criticism from French officials over the perp walk for Dominique Strauss-Kahn, the International Monetary Fund chief who was arrested this week in New York on sexual assault charges.

“I think it is humiliating, but you know if you don’t want to do the perp walk, don’t do the crime,” Bloomberg said.

He added, “The real sad thing is if someone is accused and does the perp walk and turns out not to be guilty, then society really ought to look in the mirror.”

Some in the French public were offended at the sight of Strauss-Kahn, a leading French politician, being offered up before the cameras.