The Islamabad High Court had deferred Khan's indictment over the contempt case after he apologised to the court in person late last month.
A convicted politician is liable to be disqualified from contesting elections and holding a public office for at least five years under Pakistani law.
"Imran Khan extended his apology in honour and respect for the judiciary, and the court today reciprocated by discharging the case against him," defence lawyer Faisal Chaudhry told Reuters.
The charges were related to a speech by Khan in which he was accused of threatening police and judicial officers after one of his close aides was denied bail in a sedition case.
Khan and his legal team subsequently maintained that his remarks did not amount to a threat.
The cricket star-turned-politician has faced a spate of legal woes since his ouster in a confidence vote in April by a united opposition led by his successor, Prime Minister Shehbaz Sharif.
Khan has been leading rallies since his dismissal demanding snap elections, which the ruling coalition has rejected, saying voting will be held as scheduled later next year.
(Reporting by Asif Shahzad; Editing by Mark Heinrich)
By Asif Shahzad