The rapid detection of fertilizer nutrient information is a crucial element in enabling intelligent and precise variable fertilizer application. However, traditional detection methods possess limitations, such as the difficulty in quantifying multiple components and cross-contamination. In this study, a rapid detection method was proposed, leveraging Raman spectroscopy combined with machine learning, to identify five types of fertilizers: K2SO4, (CO(NH2)2, KH2PO4, KNO3, and N:P:K (15-15-15), along with their concentrations. Qualitative and quantitative models of fertilizers were constructed using three machine learning algorithms combined with five spectral preprocessing methods. Two variable selection methods were used to optimize the quantitative model. The results showed that the classification accuracy of the five fertilizer solutions obtained by random forest (RF) was 100 %. Moreover, in terms of regression, partial least squares regression (PLSR) outperformed extreme learning machine (ELM) and least squares support vector machine (LSSVM), yielding prediction Rp2 within the range of 0.9843–0.9990 and a root mean square error in the range of 0.0486–0.1691. In addition, this study evaluated the impact of different water types (deionized water, well water, and industrial transition water) on the detection of fertilizer information via Raman spectroscopy. The results showed that while different water types did not notably affect the identification of fertilizer nutrients, they did exert a pronounced effect on the quantification of concentrations. This study highlights the efficacy of combining Raman spectroscopy with machine learning in detecting fertilizer nutrients and their concentration information effectively.