Because of the considerable tumor heterogeneity in gastric cancer (GC), only a limited group of patients experiences positive outcomes from immunotherapy. Herein, we aim to develop predictive models related to glycosylation genes to provide a more comprehensive understanding of immunotherapy for GC. RNA sequencing (RNA-seq) data and corresponding clinical outcomes were obtained from GEO and TCGA databases, and glycosylation-related genes were obtained from GlycoGene DataBase. We identified 48 differentially expressed glycosylation-related genes and established a prognostic model (seven prognosis genes including GLT8D2, GALNT6, ST3GAL6, GALNT15, GBGT1, FUT2, GXYLT2) based on these glycosylation-related genes using the results from Cox regression analysis. We found that these glycosylation-related genes revealed a robust correlation with the abundance of Tumor Infiltrating Lymphocytes (TILs), especially the GLT8D2 which is associated with many TILs. Finally, we employed immunohistochemistry and Multiplex Immunohistochemical to discover that GLT8D2 serves as a valuable prognostic biomarker in GC and is closely associated with macrophage-related markers. Collectively, we established a prognostic model based on glycosylation-related genes to provide a more comprehensive understanding of prediction for GC prognosis, and identified that GLT8D2 is closely correlated with adverse prognosis and may underscore its role in regulating immune cell infiltration in GC patients.