Abstract: This paper presents a detection method of Alternaria solani in tomatoes. Several machine learning models were used to detect the pathogen, such as the implementation of decision trees and ensemble learning methods. The use of these methods requires the acquisition of large volumes of data and adequate preprocessing of this data. For the presented study the dataset of hyperspectral measurements of two varieties of tomatoes was used. Measurements were split into two groups: one inoculated with the Alternaria solani pathogen and the other one was treated as the reference. Measurements were taken by the spectroradiometer in consecutive measurement series. The main part of the study was the evaluation of the decision trees and the popular ensemble learning algorithms to select the most accurate one. After subsequent iterations of the training process and adjustment of hyperparameters, satisfactory accuracy results, equal to 0.987 for random forest, were obtained. This paper also covers the examination of the spectral range required for Alternaria solani identification. From several variants, the accuracy of models based on VIS and NIR spectral range was the closest to the accuracy obtained with the whole spectrum of measured absolute reflectance.