Hepatocellular carcinoma (HCC) is one of the leading causes of tumor-associated deaths worldwide. Despite great progress in early diagnosis and multidisciplinary tumor management, the long-term prognosis of HCC remains poor. Currently, metabolic reprogramming during tumor development is widely observed to support rapid growth and proliferation of cancer cells, and several metabolic targets that could be used as cancer biomarkers have been identified. The liver and mitochondria are the two centers of human metabolism at the whole organism and cellular levels, respectively. Thus, identification of prognostic biomarkers based on mitochondrial-related genes (Mito-RGs)—the coding-genes of proteins located in the mitochondria—that reflect metabolic changes associated with HCC could lead to better interventions for HCC patients. In the present study, we used HCC data from The Cancer Genome Atlas (TCGA) database to construct a classifier containing 10 Mito-RGs (ACOT7, ADPRHL2, ATAD3A, BSG, FAM72A, PDK3, PDSS1, RAD51C, TOMM34, and TRMU) for predicting the prognosis of HCC by using 10-fold Least Absolute Shrinkage and Selection Operation (LASSO) cross-validation Cox regression. Based on the risk score calculated by the classifier, the samples were divided into high- and low-risk groups. Gene set enrichment analysis (GSEA), gene set variation analysis (GSVA), t-distributed stochastic neighbor embedding (t-SNE), and consensus clusterPlus algorithms were used to identify metabolic pathways that were significantly different between the high- and low-risk groups. We further investigated the relationship between metabolic status and infiltration of immune cells into HCC tumor samples by using the Cell-type Identification By Estimating Relative Subsets Of RNA Transcripts (CIBERSORT) algorithm combined with the Tumor Immune Estimation Resource (TIMER) database. Our results showed that the classifier based on Mito-RGs could act as an independent biomarker for predicting survival of HCC patients. Repression of primary bile acid biosynthesis plays a vital role in the development and poor prognosis of HCC, which provides a potential approach to treatment. Our study revealed cross-talk between bile acid and infiltration of tumors by immune cells, which may provide novel insight into immunotherapy of HCC. Furthermore, our research may provide a novel method for HCC metabolic therapy based on modulation of mitochondrial function.