Grading of agricultural products methods based on artificial intelligence is more important. Because these methods have the ability to learn and thus increase the flexibility of the system. In this paper, image processing systems, detection analysis methods, and artificial intelligence are used to grade tomatoes, and the success rate of grading these methods is compared with each other. However, the purpose of this study is to obtain a solution to detect appearance defects and grade and sort the tomato crop and provide an efficient system in this field. A visual dataset is created, to investigate the approach of image processing and machine learning based on a tomato image. Tomato models are placed individually under the camera and samples are classified in a lighting box away from the effects of ambient light. Data sets have been used in three types of first, second, and third quality categories. It should be noted that quality category one has the best quality and quality category two has the medium quality and category three has the worst quality, Also, each data class contains 80 samples. Using tomato appearance such as size, texture, color, shape, etc. Image processing is performed for extract features. Tomato images are pre-processed for optimization. Then, to prepare for classification, the dimensions of the images are reduced by principal component analysis (PCA). Three categories of an artificial neural network, a support vector machine, and a decision tree are compared to show the most efficient support machine. The analysis is examined in two classes and three classes. The support vector machine has the best accuracy compared to other methods so this rate is 99.9% for two classes and 99.79% for three classes.