Khan, 36, returned a positive result for the anabolic agent ostarine following his loss to Kell Brook in Manchester in February 2022.
Khan, who announced his retirement in May last year, accepted a violation of anti-doping rules but said he had not intentionally ingested the substance, an argument accepted by an independent panel following a hearing in January.
The ban is deemed to have commenced on 6 April 2022, when his provisional suspension was imposed, and will expire on 5 April 2024.
Khan announced his retirement in May last year after his sixth-round stoppage defeat to fellow Briton Brook on Feb 19 but would be unable to return to the ring until April 2024.
He accepted a violation of anti-doping rules but said he had not intentionally ingested the substance, an argument accepted by an independent panel following a hearing in January.
Taking about the verdict on Tuesday, Khan insisted that he had “never cheated”.
He said, “The amount that was in my system could have come from shaking peoples’ hands. I don’t know what the drug was in my system. I will give my views, but, like I say, I have never cheated in my life. I would never cheat.
“I am a retired fighter, and I have got this two-year ban now, which is quite strange. I have already retired anyway. No comeback plans at all.”
Khan became a household name in Britain after claiming a silver medal at the 2004 Athens Olympics, aged just 17.
He made his professional debut in July 2005 and four years later won the WBA light-welterweight title with victory over Andreas Kotelnik in Manchester.