Early in his career Gogol was best known for his short stories, which gained him the admiration of the Russian literary circle, including Alexander Pushkin. After establishing a reputation, Gogol began working on several plays. His first attempt to write a satirical play about imperial bureaucracy in 1832 was abandoned out of fear of censorship. In 1835, he sought inspiration for a new satirical play from Pushkin.
Do me a favour; send me some subject, comical or not, but an authentically Russian anecdote. My hand is itching to write a comedy... Give me a subject and I'll knock off a comedy in five acts — I promise, funnier than hell. For God's sake, do it. My mind and stomach are both famished.—Letter from Gogol to Pushkin, October 7, 1835
Pushkin had a storied background and was once mistaken for a government inspector in 1833. His notes alluded to an anecdote distinctly similar to what would become the basic story elements for The Government Inspector.
Krispin arrives in the Province ... to a fair – he is taken for [illegible] ... . The governor is an honest fool – the governor's wife flirts with him – Krispin woos the daughter.—Pushkin, Full collected works, volume 8, book 1