The invention relates to a method for preparing dexmedetomidine, which comprises the following steps of: 1) providing 4-imidazole formic ether, 2) reacting the 4-imidazole formic ether with stronger ammonia water and ammonium chloride so as to form 4-imidazole acid amide, 3) reacting the 4-imidazole acid amide with a cyaniding agent so as to form 4-cyano-group imidazole, and 4) generating the dexmedetomidine from the 4-cyano-group imidazole. The method of the invention needs no blocking group and de-blocking group, uses the cheap raw materials which are easily obtained, has simple route, requires mild reaction condition, has low demand on production device and has a small volume of the three wastes. The prepared dexmedetomidine has high yield coefficient and high purity and is fit for industrial production.