In this paper, a 2D mesoscale finite element (FE) numerical model of mortar, considering the influence of the ITZ, was proposed to evaluate the corrosion of mortar in sodium sulfate. On the mesoscale, the corroded mortar was regarded as a three-phase composite material composed of sand, cement paste, and an interface transition zone (ITZ). Firstly, the volume fractions and mechanical parameters (elastic modulus, Poisson’s ratio, and strength) of the mesoscale phases were obtained. Then, the cement paste and the ITZ were combined to form an equivalent matrix by homogenization methods, and the calibrated constitutive relations of the equivalent matrix were established. Subsequently, a two-dimensional (2D) random circular aggregate (RCA) model and a 2D random polygonal aggregate (RPA) model of corroded mortar were established using the random aggregate model. The failure process of corroded mortar specimens under uniaxial compression was simulated by the mesoscale FE numerical model. Comparing the simulation results with the measured stress–strain curves of the uniaxial compression test, it was found that the simulation results of the 2D RP model were closer to the experimental results than those of the 2D RC model. Meanwhile, the numerical simulation results were in good agreement with the experimental results, and the error values of peak stress between the simulation results and the measured results were within 7%, which showed that the 2D mesoscale FE model could accurately predict the results of a uniaxial compression test of a mortar specimen under sulfate attack.