The number of people dying from lung cancer in the world is increasing day by day. Therefore, early diagnosis of lung cancer holds a prominent position for the recovery of patients. Chest computed tomography scan images that are clinical adjuncts are used in the diagnosis of lung cancer. Herein, the proposed method automatically diagnoses lung cancer using machine learning algorithms, probabilistic majority voting, and optimization techniques. The paper uses images from Adenocarcinoma Left Lower Lobe, Large Cell Carcinoma Left Hilum, Normal, and Squamous Cell Carcinoma Left Hilum subjects. 80% and 20% of these images are used in the training and validation set, respectively, and there are 1000 images in the data set. For each image used in the study, image features are extracted using the Bag of Features method (2000 features). Linear Discriminant, Optimizable Support Vector Machine, and Optimizable K-Nearest Neighbor (KNN) classifiers are trained using these features. Afterward, the new image label is estimated in two steps. First, if the two or three classifier outputs are the same, the image label is detected using the majority voting technique. Second, if the classifier outputs are not the same, the image label is determined according to the most successful classifier, Optimizable KNN. To better experience the majority voting technique used in the proposed method, its detailed theoretical framework is given in the study.Additionally, the Graphical User Interface application of the proposed method has been designed to save time and reduce the workload of expert radiologists.From the results, it is seen that the Accuracy (%), Error (%), Sensitivity (%), Specificity (%), Precision (%), F 1 Score (%), Matthews Correlation Coefficient, and Kappa of the proposed method are equal to 99.2837, 0.007163, 99.2571, 99.9139, 99.3486, 99.2816, 0.98738, and 0.94965 respectively.