Posthepatectomy liver failure (PHLF) is a major cause of postoperative mortality in hepatocellular carcinoma (HCC) patients. The study aimed to develop a method based on the two-dimensional shear wave elastography and clinical data to evaluate the risk of PHLF in HCC patients with chronic hepatitis B. This multicenter study proposed a deep learning model (PHLF-Net) incorporating dual-modal ultrasound features and clinical indicators to predict the PHLF risk. The datasets were divided into a training cohort, an internal validation cohort, an internal independent testing cohort, and three external independent testing cohorts. Based on ResNet50 pretrained on ImageNet, PHLF-Net used a progressive training strategy with images of varying granularity and incorporated conventional B-mode and elastography images and clinical indicators related to liver reserve function. In total, 532 HCC patients who underwent hepatectomy at five hospitals were enrolled. PHLF occurred in 147 patients (27.6%, 147/532). The PHLF-Net combining dual-modal ultrasound and clinical indicators demonstrated high effectiveness for predicting PHLF, with AUCs of 0.957 and 0.923 in the internal validation and testing sets, and AUCs of 0.950, 0.860, and 1.000 in the other three independent external testing sets. The performance of PHLF-Net outperformed models of single- and dual-modal US. Preoperative ultrasound imaging combining clinical indicators can effectively predict the PHLF probability in patients with HCC. In the internal and external validation sets, PHLF-Net demonstrated its usefulness in predicting PHLF.