A federal judge in Brooklyn got a kick out of the fact that a defendant named Martin Shkreli appeared before him in court on Thursday — as “America’s most hated man” Martin Shkreli was standing trial in the same courthouse on securities fraud charges.

“Is his name also Martin Shkreli? Is that name common in that community?” chuckled Judge Steven Gold to court clerks.

The lesser-known Shkreli, 59, was hauled into court for his alleged role in a money-laundering scheme that trafficked drugs and weapons, including an M80 Zolja anti-tank rocket launcher and 15 AK-47s from Kosovo.

The resident of upstate Bedford is accused of cutting “clean checks” used in the laundering scam that ensnared nine others.

He was released on $200,000 bond after surrendering to authorities Thursday.

Meanwhile, on the sixth floor of the courthouse, the trial for “Pharma Bro” Martin Shkreli was under way.

The former CEO of biopharmaceuticals firm Retrophin, 34, is accused of orchestrating an $11 million Ponzi scheme.

He faces up to 20 years in prison.