The effect of Ce and Mg on surface microcracks of Al–20Si alloys induced via high-current pulsed electron beam (HCPEB) was studied. Mg was revealed to refine the primary Si phase in the pristine microstructure by forming a Mg2Si phase, leading to the suppression of microcrack propagation within the brittle phase after HCPEB irradiation. The incorporation of Ce into the Al–Si–Mg alloys further refined the primary Si phase and reduced the local stress concentration in the brittle phase induced by HCPEB irradiation. Ultimately, the surface microcracks were observed to be eliminated by the synergistic effects between the two elements. For Al–20Si–5Mg–0.7Ce alloys, Ce demonstrated a homogeneous distribution in the Al matrix on the HCPEB-irradiated alloy surface, while the Mg and Si exhibited a certain degree of aggregation in the Mg2Si phase. Metastable structures were formed on the HCPEB-irradiated alloy surface, including the nano-primary silicon phase, nano-cellular aluminium structure, and nano-Mg2Si phase. Compared with alloy specimens containing Mg, the Al–20Si–5Mg–0.7Ce alloy specimens exhibited an excellent anticorrosion property after HCPEB irradiation mainly due to the combined effects of the grain refinement and microcrack elimination.