Background: The tumor microenvironment (TME) mainly comprises tumor cells and tumor-infiltrating immune cells mixed with stromal components. Latestresearch hasdisplayed that tumor immune cell infiltration (ICI) is associated with the clinical outcome of patients with osteosarcoma (OS). This work aimed to build a gene signature according to ICI in OS for predicting patient outcomes.Methods: The TARGET-OS dataset was used for model training, while the GSE21257 dataset was taken forvalidation. Unsupervised clustering was performed on the training cohort based on the ICI profiles. The Kaplan–Meier estimator and univariate Cox proportional hazards models were used to identify the differentially expressed genes between clusters to preliminarily screen for potential prognostic genes. We incorporated these potential prognostic genes into a LASSO regression analysis and produced a gene signature, which was next assessed with the Kaplan–Meier estimator, Cox proportional hazards models, ROC curves, IAUC, and IBS in the training and validation cohorts. In addition, we compared our signature to previous models. GSEAswere deployed to further study the functional mechanism of the signature. We conducted an analysis of 22 TICsfor identifying the role of TICs in the gene signature’s prognosis ability.Results: Data from the training cohort were used to generate a nine-gene signature. The Kaplan–Meier estimator, Cox proportional hazards models, ROC curves, IAUC, and IBS validated the signature’s capacity and independence in predicting the outcomes of OS patients in the validation cohort. A comparison with previous studies confirmed the superiority of our signature regarding its prognostic ability. Annotation analysis revealed the mechanism related to the gene signature specifically. The immune-infiltration analysis uncoveredkey roles for activated mast cells in the prognosis of OS.Conclusion: We identified a robust nine-gene signature (ZFP90, UHRF2, SELPLG, PLD3, PLCB4, IFNGR1, DLEU2, ATP6V1E1, and ANXA5) that can predict OS outcome precisely and is strongly linked to activated mast cells.