To achieve rapid, non-destructive detection of food quality indicators, this study introduces a novel method that combines near-infrared (NIR) spectroscopy with the Extreme learning machine (ELM) model. Eight spectral preprocessing methods and three wavelength selection algorithms were evaluated for predicting total ginsenoside content (TGC) and protein content (PC), along with a comparative analysis of the ELM model's performance against support vector regression and random forest. Results showed that Savitzky-Golay smoothing with standard normal variate was the best preprocessing method, K-means clustering provided the optimal wavelength selection algorithm, and the ELM model demonstrated the best performance. Specifically, the ELM based on K-means method achieved optimal results: R2 of 0.9431, RMSE of 0.2933 mg/g, rRMSE of 0.0824, RPD of 4.2386, and P-time of 4 × 10-7 s for TGC; and R2 of 0.9764, RMSE of 4.1361 mg/g, rRMSE of 0.0337, RPD of 6.1295, and P-time of 2 × 10-7 s for PC. In summary, combining NIR spectroscopy with the ELM model and clustering-based wavelength selection algorithm offers a reliable and practical solution for rapid, non-destructive, and accurate detection of food quality indicators.