【Background】 Accurate detection of sodium (Na), potassium (K) and magnesium (Mg) content in milk contributes to healthy dairy farming and is a prerequisite for stabilizing the quality of dairy products. However, the current conventional methods for detecting mineral content in milk are expensive and time-consuming, so there is a need for a low-cost and rapid method to measure the Na, K and Mg content in milk. 【Objective】 The purpose of this study was to investigate the potential of using milk-infrared spectroscopy (MIRS) to predict the Na, K and Mg content in milk from Chinese Holstein cows, to provide a rapid detection technique for the determination of Na, K and Mg content in milk, and to provide a large amount of phenotypic data for the herd management and genetic breeding of dairy cows. In addition, the ability of different feature selection algorithms to improve the MIRS quantitative prediction model for predicting Na, K and Mg content in milk were compared. 【Method】 A total of 255 milk samples from healthy Holstein cows from North China were used for this study. Firstly, MIRS data of milk samples were collected using MilkoScanTMFT+, and the true values of Na, K and Mg content in milk samples were determined using inductively coupled plasma atomic emission spectrometry. Subsequently, using the MIRS data as the predictor variables and the true values of Na, K and Mg content as the dependent variables, four spectral preprocessing algorithms (first-order derivative, second-order derivative, SG smoothing, and standard normal transform), four feature selection algorithms [uninformative variable elimination (UVE), competitive adaptive reweighted sampling (CARS), genetic algorithm, and least angle regression (LAR)] and nine modelling algorithms (partial least squares regression, support vector machines, Random Forest and Elasticity Network, etc.) were used to establish MIRS quantitative prediction models for predicting Na, K and Mg content in milk, respectively, and the optimal model combination (Feature Selection Algorithm + Spectral Preprocessing Algorithm + Modelling Algorithm) was selected. 【Result】 Overall, the CARS algorithm improved the Na, K and Mg content prediction models better than the UVE, GA and LAR algorithm. The Na content prediction model developed based on CARS feature selection algorithm, first-order derivative preprocessing and elastic network modelling algorithm was the most effective, and the model had a coefficient of determination of prediction set (RP2)=0.72, root mean squared error of prediction set (RMSEp)=63.28 mg∙kg-1, mean absolute error of prediction set (MAEp)=49.03 mg∙kg-1, and performance deviation ratio (ratio)=1.90. The best K content prediction model was developed based on the CARS feature selection algorithm, raw spectra and support vector machine modelling algorithm, which had RP2=0.57, RMSEp=141.49 mg∙kg-1, MAEp=116.24 mg∙kg-1, RPD=1.57. Mg content prediction model developed based on CARS feature selection algorithm, raw spectra and partial least squares regression modelling algorithm was the most effective, the model RP2=0.51, RMSEp=12.08 mg∙kg-1, MAEp=9.84 mg∙kg-1, and RPD=1.30. 【Conclusion】 It was feasible to use MIRS to predict Na and K content in milk from Chinese Holstein cows, which could predict Na content with a high degree of accuracy and approximate quantitative prediction of K content (for distinguishing between low and high K concentration samples). The use of the CARS algorithm to extract the characteristic bands before modelling improved the accuracy of the MIRS prediction model, and greatly reduced the computing time to improve the efficiency of the MIRS model in predicting phenotypic data.