The invention discloses a preparation method of a composite film layer on the surface of a rare earth magnesium alloy structural part. The preparation method sequentially comprises the steps of oil removal, primary water washing, micro-arc oxidation, secondary water washing, electrophoresis, tertiary water washing and drying and curing. A micro-arc oxidation electrolyte is an aqueous solution containing sodium silicate, sodium fluoride, sodium hydroxide, graphene, Cu(NO3)2 and triethanolamine, electrical parameters of micro-arc oxidation are as follows: the positive current density is 5-15A/dm<2>, the negative current density is 2-3A/dm<2>, the positive duty ratio is 25-70%, the negative duty ratio is 40-50%, the positive frequency is 200-800Hz, the negative frequency is 300-500Hz, the positive and negative stages are both one stage, the micro-arc oxidation time is 10-20 min, electrophoresis liquid for electrophoresis is an aqueous solution containing acrylate, a delustering agent andcarbon black pigment, and electrical parameters of electrophoresis are as follows: the voltage is 50-80V, and the time is 10-30s; and through the coordination effect of micro-arc oxidation and electrophoresis, the composite film layer meeting the requirements of high hardness, high bonding strength and ultraviolet aging resistance at the same time can be prepared.