The invention discloses a method for preparing metformin hydrochloride. Dicyandiamide and dimethylamine hydrochloride are used as raw materials, and the molar ratio of dicyandiamide and dimethylamine hydrochloride is 1:1~1:1.2. 2~4 times the amount of N,N-dimethylacetamide or dimethyl sulfoxide as a solvent, react at 140±5°C for 4~8h, and prepare the crude metformin hydrochloride; recrystallize the crude product with ethanol, and adjust the pH value to 5 ~6, decolorize, stir and cool down to -10~0°C to crystallize, filter and dry to obtain the fine metformin hydrochloride, and recover the solvent from the filtrate. The qualified product yield of the invention is 80-85%, and the purity is high. Due to the high boiling point of the selected reaction solvent, the recovery rate of the solvent is high; the flushing phenomenon can also be effectively avoided, so the reaction conditions are mild, the operation is simple, and the safety is high.