It’s a lesson he should have learned from Plaxico Burress — but this was worse.

A 15-year-old Brooklyn boy shot himself in the penis Sunday after fumbling with a gun that had slid from his waistband, authorities said yesterday.

Khamir Grant was then arrested for reckless endangerment and criminal possession of a weapon — the same charges levied against Burress, who shot himself at a Manhattan nightclub in 2008, law-enforcement sources said.

Grant told cops that he was walking home from Amersfort Park at East 39th Street and Avenue J in East Flatbush around 1:30 a.m., when the gun began to fall into his pants, sources said.

When Grant grabbed for it, he accidentally pulled the trigger, firing a bullet right through his penis.

Grant staggered home and told his mom what had happened, sources said.

They took a livery car to Kings County Hospital, where Grant was released after treatment and then arrested by police.

jamie.schram@nypost.com