With the increasing soybean production in Brazil, and the demand for soybeans with high protein and oil content, it is essential to conduct an in-depth study of the constituents of this grain, which can vary according to genotypes and growing conditions. Therefore, the objective of this study was to classify soybean genotypes, cultivated in different environments and sowing seasons, according to their chemical composition and the spectrum generated by near-infrared spectroscopy (NIRS). For this purpose, artificial intelligence and its machine learning technique were employed. 10 soybean genotypes were used, sown in two sowing seasons and cultivated 7 cities in Rio Grande do Sul. The chemical composition of the samples was analyzed using the FOSS NIRS DS2500 equipment, selecting the band between 807 and 817 nm. The applied algorithms were J48, Random Forest, CVR, lBk, MLP, using the Resample filter. The Weka software, version 3.8.6, was employed for data mining. The IBk algorithm achieved the best performance, reaching 89% correct classification of attributes. From the Confusion Matrix, it was observed that all genotypes obtained results above 60/70 for correctly predicted values, highlighting the algorithms’ good performance. In the metrics, IBk achieved 0.89 Precision, Recall, and F-Measure, and 0.94 ROC Area. Thus, it was possible to classify the genotypes according to their chemical composition related to the data obtained in the spectral curve, sowing season, and environment, using artificial intelligence and machine learning.