To develop and validate a prediction model for high-flow nasal cannula (HFNC) failure in patients with acute hypoxaemic respiratory failure (AHRF). AHRF accounts for a major proportion of intensive care unit (ICU) admissions and is associated with high mortality. HFNC is a non-invasive respiratory support technique that can improve patient oxygenation. However, HFNC failure, defined as the need for escalation to invasive mechanical ventilation, can lead to delayed intubation, prolonged mechanical ventilation and increased risk of mortality. Timely and accurate prediction of HFNC failure has important clinical implications. Machine learning (ML) can improve clinical prediction. Multicentre observational study. This study analysed 581 patients from an academic medical centre in Boston and 180 patients from Guangzhou, China treated with HFNC for AHRF. The Boston dataset was randomly divided into a training set (90%, n = 522) and an internal validation set (10%, n = 59), and the model was externally validated using the Guangzhou dataset (n = 180). A random forest (RF)-based feature selection method was used to identify predictive factors. Nine machine learning algorithms were selected to build the predictive model. The area under the receiver operating characteristic curve (AUC) and performance evaluation parameters were used to evaluate the models. The final model included 38 features selected using the RF method, with additional input from clinical specialists. Models based on ensemble learning outperformed other models (internal validation AUC: 0.83; external validation AUC: 0.75). Important predictors of HFNC failure include Glasgow Coma Scale scores and Sequential Organ Failure Assessment scores, albumin levels measured during HFNC treatment, ROX index at ICU admission and sepsis. This study developed an interpretable ML model that accurately predicts the risk of HFNC failure in patients with AHRF. Clinicians and nurses can use ML models for early risk assessment and decision support in AHRF patients receiving HFNC. TRIPOD checklist for prediction model studies was followed in this study. Patients were involved in the sample of the study.