Cashmere and wool fibers have similar chemical compositions, making them difficult to distinguish based on their absorption peaks and band positions in near-infrared spectroscopy. Existing studies commonly use wavelength selection or feature extraction algorithms to obtain significant spectral features, but traditional algorithms often overlook the correlations between wavelengths, resulting in weak adaptability and local optimum issues. To address this problem, this paper proposes a recognition algorithm based on optimal wavelength selection, which can remove redundant information and make the model effective in capturing patterns and key features of the data. The wavelengths are rearranged by computing the information gain ratio for each wavelength. Then, the sorted wavelengths are grouped based on equal density, which ensures that all wavelengths within each group have equal information and avoids over-focusing on individual groups. Meanwhile, the group genetic algorithm is used to find the wavelengths with highly informative and search optimal grouped combinations, in order to explore the entire spectrum wavelength. Finally, combined with a partial least squares discriminant analysis(PLS-DA) model, the recognition accuracy reached 97.3 %. The results indicate that, compared to traditional methods such as CARS, SPA, and GA, our method effectively reduces redundant information, selects fewer but more informative wavelengths, and improves classification accuracy and model adaptability.