The transformation of farmers' status in Thailand emphasizes the societal and economic changes impacting the image of farmers and agricultural activities. It is noted that farmers are aging, and there is a decline in the number of new-generation farmers, leading to a scarcity in agricultural technology and innovation development. Farmers necessitate technology development and productstandardization to meet market demands and enhance product value. New-generation farmers need to cultivate skills in modern agriculture. Information technology plays a pivotal role in analyzing customer sentiments, aiding business planning, and decision-making. This research aims to examine the types and levels of brand loyalty in agricultural products through machine learning tools, utilizing qualitative research methods such as interviews and observations from a sample group of customers who have previously purchased agricultural products from businesses. In-depth interviews were conducted, and the data were fed into learning models to analyze customer opinions using natural language processing and machine learning algorithms, including Support Vector Machines (SVM), Naiive Bayes, and Decision Trees. These algorithms were employed to compare the effectiveness of categorizing brand loyalty categories in agricultural products. The study found that enhancing customer satisfaction or reducing dissatisfaction with products or services could be achieved using data derived from classification methods through learning sets. Brand loyalty towards agricultural products is most significant at level 1 and decreases as it ascends to level 5 in the positive opinion group.Conversely, it is highest at level 1 and diminishes as it goes up to level 2 in the negative opinion group. The obtained data can facilitate businesses in efficient planning and decision-making, ultimately enhancing their competitive advantage.