BackgroundMilk produced by dairy cows is a complex combination of many components, but the effect of mastitis has only been investigated for a few of these components. Milk mid‐infrared (MIR) spectra can reflect the global composition of milk, and this study aimed to detect the relationships between milk MIR spectral wavenumbers and milk somatic cell count (SCC)—a sensitive biomarker for mastitis.MethodsPearson correlation analysis was used to calculate the correlation coefficient between somatic count score (SCS) and spectral wavenumbers. A general linear mixed model was applied to investigate the effect of three different classes of SCC (low, middle and high) on spectral wavenumbers.ResultsThe mean correlation coefficient between the ‘fingerprint region’ (wavenumbers 925–1582 cm–1) and the SCS was higher than that for other regions of the MIR spectrum, and the specific wavenumber with the strongest correlation with the SCS was within the ‘fingerprint region’. SCC class had a significant (p < 0.05) effect on 639 spectral wavenumbers. In particular, some spectral wavenumbers within the ‘fingerprint region’ were highly affected by the SCC class.LimitationThe data were collected from only one province in China, so the generalisability of the findings may be limited.ConclusionSCC had close relationships with milk spectral wavenumbers related to important milk components or chemical bonds.