Rare earth alloying is one of the effective ways to improve the performance of magnesium alloys, but strong galvanic corrosion occurs when rare earth magnesium alloys meet corrosive substances. To improve the corrosion resistance of rare earth magnesium alloys, this article takes Mg-13Gd-4Y-2Zn-0.5Zr rare earth magnesium alloy as the research object. First, a one-step micro arc oxidation process is used to obtain the film layer. The experiment shows that when the chemical composition and concentration of the electrolyte are constant, changing the voltage parameter of the one-step micro arc oxidation alone cannot prepare a thick, dense, and corrosion-resistant micro arc oxidation film layer, which cannot meet the practical application needs of rare earth magnesium alloys. Then, the one-step micro arc oxidation film layer is used as the substrate sample. By changing the voltage parameters, the sample is subjected to a second micro arc oxidation treatment to prepare a two-step micro arc oxidation film layer. In the study, it is found that the two-step microarc oxidation process increased the thickness of the film layer, which has good densification and corrosion resistance at a voltage of 452.5 V, improving the corrosion resistance of the film layer.