Gastric cancer is one of the most common and deadly types of cancer in the world. To develop new biomarkers and drugs to diagnose and treat this cancer, it is necessary to identify the differences between the transcriptome profiles of gastric cancer and healthy individuals, identify critical genes associated with these differences, and make potential drug predictions based on these genes. In this study, using two gene expression datasets related to gastric cancer (GSE19826 and GSE79973), 200 genes that were ready for machine learning were selected, and their expression levels were analyzed. The best 100 genes for the model were chosen with the permutation feature importance method, and central genes, such as SCARB1, ETV3, SPATA17, FAM167A-AS1, and MTBP, which were shown to be associated with gastric cancer, were identified. Then, using the drug repurposing method with the Connectivity Map CLUE Query tools, potential drugs such as Forskolin, Gestrinone, Cediranib, Apicidine, and Everolimus, which showed a highly negative correlation with the expression levels of the selected genes, were identified. This study provides a method to develop new approaches to diagnosing and treating gastric cancer by comparing the transcriptome profiles of patients gastric cancer and performing a feature engineering-assisted drug repurposing analysis based on cancer data.