Background: Hepatitis B virus (HBV) is the dominant pathogenic factor of HCC in Asia and Africa. This study aims to identify significant biomarkers and develop a novel genetic model for the efficient diagnosis of HBV-related HCC.Methods:GSE19665, GSE55092, and GSE121248 were merged and used to identify significant differentially expressed genes (DEGs). The enrichment analysis was performed on Metascape and Database for Annotation, Visualisation and Integrated Discovery (DAVID) online tool. The random forest (RF) algorithm and artificial neural network (ANN) were used to select the potential predictive gene panels and construct an HBV-related HCC diagnostic model. Subsequently, GSE17548, GSE104310, GSE44074, and GSE136247 were used to test the accuracy of the ANN model. Finally, the CIBERSORT algorithm was used to assess the abundance of immune infiltrates in all samples.Results: First, 116 genes were identified as DEGs from the merged dataset, and the enrichment analysis showed that DEGs were particularly enriched in cellular hormone metabolic process, monocarboxylic acid metabolic process, NABA ECM AFFILIATED steroid metabolic process and metabolism of bile acid and bile salt. TOP2A, CLEC1B, BUB1B, FCN2, CXCL14, CAP2,FCN3, KMO and CDHR2 were available to develop an HBV-related HCC diagnostic model. After validation, the diagnostic model has high sensitivity and specificity in four datasets, and the areas under the ROC curves efficiency was excellent. Finally, the percentage of infiltrating immune cell types for hepatitis B-related HCC were significantly different from that of non-cancerous liver tissue with HBV.Conclusion: A novel early diagnostic model of HBV-related HCC was established, and the model has better efficiency in distinguishing HBV-related HCC from other non-cancerous with HBV individuals. This study will provide a promising theoretical basis for early diagnosis and immunity therapy of HBV-related HCC.