We aimed to establish a machine learning radiomics liver function model to explore how liver function affects the prognosis of patients with gastric cancer (GC). Patients with advanced GC were retrospectively enrolled in this study. Eight machine learning radiomic models were constructed by extracting radiomic features from portal-vein-phase contrast-enhanced computed tomography (CE-CT) images. Clinicopathological features were determined using univariate and multifactorial Cox regression analyses. These features were used to construct a GC survival nomogram. A total of 510 patients with GC were split into training and test cohorts in an 8:2 ratio. Kaplan-Meier analysis showed that patients with typeI liver function had a better prognosis. Fifteen significant features were retained to establish the machine learning model. LightBGM showed the best predictive performance in the training (area under the receiver operating characteristic curve [AUC] 0.978) and test cohorts (AUC 0.714). Multivariate analysis revealed that gender, age, liver function, Nutritional Risk Screening 2002 (NRS-2002) score, tumor-lymph node-metastasis stage, tumor size, and tumor differentiation were independent risk factors for GC prognosis. The survival nomogram based on machine learning radiomics, instead of liver biochemical indicators, still had high accuracy (C-index of 0.771 vs. 0.773). The machine learning radiomics liver function model has high diagnostic value in predicting the influence of liver function on prognosis in patients with GC.