At present, the gap of agricultural talents in China is continuously widening, and most enterprises lack agricultural core talents, which has caused great impact on the social economy. To solve this problem, an improved AHP-KNN algorithm is proposed by combining the analytic hierarchy process (AHP) and the optimized K-nearest neighbor algorithm, and an agricultural talent training model is proposed based on this algorithm. The results show that the classification accuracy and classification time of the improved AHP-KNN algorithm are 96.2% and 27.5 seconds, respectively, both of which are superior to the comparison algorithm. The result shows that the classification accuracy of agricultural talents can be improved by using this algorithm. Therefore, the model can be used to classify agricultural talents with the same characteristics into one class, carry out targeted training, and train all-round agricultural talents efficiently and quickly, so as to improve the serious shortage of agricultural talents at present.