The influence of changes in the chemical composition of slag formed during cast iron desulfurization by blowing a mixture of lime and magnesium on the adhesion conditions to the refractories of the cast iron ladle was investigated. A statistically adequate linear regression model of refractory wetting by CaO-SiO2-MgO-Al2O3 slag was constructed. It was shown that the wetting of Al2O3- and SiC-based refractories by slag has a significantly nonlinear nature and is accompanied by a complex of interphase reactions. According to the results of the analysis of isolines in the MgO–Al2O3 plane at a fixed CaO content in the slag, an increase in the content of MgO is accompanied by a decrease in the contact angle, while an increase in (Al2O3) content is accompanied by an increase in the contact angle and a deterioration in the wetting of the refractory surface by slag, which is due to the high thermodynamic stability of alumina and the effect on the reactivity of slag to Al2O3-SiC refractories. A thermodynamic interpretation of the stability of ladle slag oxides and possible reactions in the temperature range of cast iron treatment is presented. Calculations were performed to optimize the composition of ladle slag for cast iron desulfurization in order to reduce the intensity of corrosion on the working layer of refractories in the cast iron ladle. The rational composition of slag for the conditions of the UDC of Kamet-Stal PJSC was determined: 42—46 % (CaO), 5—8 % (MgO), 6—9 % (Al2O3). The use of a three-layer lining for 230-ton iron-pouring ladles at Kamet-Steel PJSC is proposed: a working layer (8—20 mm thick) made of refractories containing 78—80 % MgO, 10—12 % Al2O3 and 5—7 % MgAl2O4; a middle layer (10—30 mm thick) of refractories containing 65 % Al2O3, 15—20 % SiC, 5—7 % C, and up to 3 % MgAl2O4; an inner layer of refractories containing 70 % Al2O3 and 8—10 % SiC.