It is a known fact that gastrointestinal diseases are extremely common among the public. The most common of these diseases are gastritis, reflux, and dyspepsia. Since the symptoms of these diseases are similar, diagnosis can often be confused. Therefore, it is of great importance to make these diagnoses faster and more accurate by using computer-aided systems. Therefore, in this article, a new artificial intelligence-based hybrid method was developed to classify images with high accuracy of anatomical landmarks that cause gastrointestinal diseases, pathological findings and polyps removed during endoscopy, which usually cause cancer. In the proposed method, firstly trained InceptionV3 and MobileNetV2 architectures are used and feature extraction is performed with these two architectures. Then, the features obtained from InceptionV3 and MobileNetV2 architectures are merged. Thanks to this merging process, different features belonging to the same images were brought together. However, these features contain irrelevant and redundant features that may have a negative impact on classification performance. Therefore, Dandelion Optimizer (DO), one of the most recent metaheuristic optimization algorithms, was used as a feature selector to select the appropriate features to improve the classification performance and support vector machine (SVM) was used as a classifier. In the experimental study, the proposed method was also compared with different convolutional neural network (CNN) models and it was found that the proposed method achieved better results. The accuracy value obtained in the proposed model is 93.88%.