A drug dealer who allegedly sold a top Manhattan doctor the heroin that killed him has been busted — thanks to cops who tracked him down using a stamp on a package of the dope, law enforcement sources said Friday.

Jeffery Cortez, 33, was hit with federal charges in connection with the death of Dr. Ravindra Rajmane, 51, who overdosed in his posh Park Avenue pad in December, the sources said.

Near his lifeless body, cops found envelopes dotted with heroin residue — and stamped with the name “Knock Out King,” police sources said at the time.

The brand name led investigators to Cortez, according to federal law enforcement officials, who arrested him Feb. 20.

A building maintenance worker found Rajmane dead on his bed Dec. 12 after a co-worker reported he hadn’t shown up to work, according to reports.

Cortez has a rap sheet with at least a dozen arrests, including charges for drugs and grand larceny.

He was hit with charges in New York Southern District Court.