The invention relates to a method for preparing a strontium-containing hydroxyapatite coating on the surface of a biodegradable magnesium alloy. The method comprises the following steps: polishing a magnesium alloy matrix to remove a surface oxidation layer, and cleaning; preparing a hydrothermal solution from calcium nitrate tetrahydrate, EDTA-2 Na, sodium dihydrogen phosphate dihydrate and strontium nitrate; and placing the well treated magnesium alloy matrix into the hydrothermal solution for hydrothermal reaction to obtain the strontium-containing hydroxyapatite coating, a biomimetic calcium phosphate coating, wrapping the magnesium alloy matrix. Compared with the prior art, as the hydrothermal method is adopted to prepare hydroxyapatite, not only is the degradation rate of the magnesium alloy in a human body effectively slowed down, but also the biocompatibility of the magnesium alloy is further improved. As strontium element is added into the hydroxyapatite coating, and as one of trace elements of the human body, strontium has the functions of promoting bone formation and inhibiting bone breakage, both the biological activity and the biocompatibility are improved.