The electrical conductivity of soil is closely associated with various physical properties of the soil, and accurately establishing the interrelationship between them has long been a critical challenge limiting its widespread application. Traditional approaches in geotechnical engineering have relied on specific conduction mechanisms and simplifying assumptions to construct theoretical models for electrical conductivity. This paper adopts a different approach by using machine learning methods to predict the electrical conductivity of clay materials. A reliable dataset was generated using the quartet structure generation set to create random clay microstructures and calculate their electrical conductivity. Based on this dataset, machine learning methods such as least squares support vector machine and backpropagation neural networks outperform theoretical models in terms of prediction accuracy and resistance to interference, with a coefficient of determination (R2) exceeding 0.995 when unaffected by disturbances. The computation of Shapley values for input features aids in explicating the machine learning model. The results reveal that saturation is a key feature in predicting electrical conductivity, while porosity and constrained diameter are relatively less important. Finally, an already trained model is applied to the one-dimensional electroosmosis-surcharge preloading consolidation theory. The results of the calculations demonstrate that neglecting changes in soil electrical conductivity during electroosmosis can lead to an overestimation of the absolute values of anode excess pore water pressure and soil settlement.