The stability of open-pit mine slopes is crucial for safety, especially for spoil dump slopes, which are prone to cracks leading to landslides. This study investigates the use of xanthan gum (XG) to enhance the stability of mudstone in spoil dumps. Various concentrations of xanthan gum were mixed with mudstone and subjected to dry–wet cycle tests to assess the impact on crack development. Pore and crack analysis system (PCAS) was utilized for image recognition and crack analysis, comparing the efficiency of crack rate and length modification. The study found that xanthan gum addition significantly improved mudstone’s resistance to crack development post-drying shrinkage. A 2% xanthan gum content reduced the mudstone crack rate by 45% on average, while 1.5% xanthan gum reduced crack length by 46.2% and crack width by 26.3%. Xanthan gum also influenced the fractal dimension and water retention of mudstone cracks. The optimal xanthan gum content for mudstone modification was identified as between 1.5% and 2%. Scanning electron microscopy imaging and X-ray diffraction tests supported the findings, indicating that xanthan gum modifies mudstone by encapsulation and penetration in wet conditions and matrix concentration and connection in dry conditions. These results are expected to aid in the development of crack prevention methods and engineering applications for open-pit mine spoil dump slopes.