Near-infrared spectroscopy (NIR) is an efficient and accurate method for fat content detection in walnuts. ‘Wen 185’ walnut is grown in large quantities in southern Xinjiang, and its fat content is an important indicator for evaluating the intrinsic quality. The excessive pursuit of yield efficiency, combined with the neglect of quality, agricultural product safety and other factors, has led to the production of poor-quality walnuts. Moreover, research on predicting walnut kernel fat content based on near-infrared spectroscopy technology is rarely reported. Therefore, a technical framework for walnut kernel detection based on near-infrared spectroscopy and the technical standards for ‘Wen 185’ are urgently needed. After first optimizing the initial spectrum data using five preprocessing methods, we established separate prediction models for walnut kernel fat content based on either a back propagation neural network or a support vector regression (SVR) algorithm. The results show that the correction set and validation set coefficients of determination of the walnut kernel fat content prediction model using the back propagation neural network algorithm were 0.86 and 0.89, respectively, with root mean square errors of 1.56 and 1.58, and an RPD value of 2.57; the coefficients of determination for the calibration and validation sets of SVR were 0.90 and 0.83, respectively, with root mean square errors of 1.76 and 1.70, respectively, and an RPD value of 1.70. Thus, near-infrared spectroscopy can be used to establish a foundation for realizing the rapid detection of walnut kernel fat content.