The present invention provides a process for preparing highly pure 4-amino-1-isobutyl-1H-imidazo[4,5-c]quinoline (imiquimod). The process preferably includes heating 4-chloro-1-isobutyl-1H-imidazo[4,5-c]quinoline of formula (II) with ammonia in a polar aprotic solvent at relatively moderate pressure to produce imiquimod, and optionally purifying the imiquimod. The process of the present invention can produce highly pure imiquimod in high yield.