The accurate prediction of the spatial variability for soil water content (SWC) in farmland is essential for water resource management and sustainable agricultural development. However, natural factors introduce uncertainty and result in poor alignment when predicting farmland SWC, leading to low accuracy. To address this, this study introduced a novel indicator: landscape indices. These indices include the largest patch index (LPI), edge density (ED), aggregation index (AI), patch cohesion index (COH), contagion index (CON), landscape division index (DIV), percentage of like adjacencies (PLA), Shannon evenness index (SHEI), and Shannon diversity index (SHDI). A Bayesian optimization–deep forest (BO–DF) model was developed to leverage these indices for predicting the spatial variability of SWC. Statistical analysis revealed that landscape indices exhibited skewed distributions and weak linear correlations with SWC (r < 0.2). Despite this, incorporating landscape index variables into the BO–DF model significantly improved prediction accuracy, with R2 increasing by 35.85%. This model demonstrated a robust nonlinear fitting capability for the spatial variability of SWC. Spatial mapping of SWC using the BO–DF model indicated that high-value areas were predominantly located in the eastern and southern regions of the Yellow River Delta in China. Furthermore, the SHapley additive explanation (SHAP) analysis highlighted that landscape indices were key drivers in predicting SWC. These findings underscore the potential of landscape indices as valuable variables for spatial SWC prediction, supporting regional strategies for sustainable agricultural development.