Shore power offers convenient and sustainable power services to ships docking in ports, playing a pivotal role in advancing environmental preservation and the effective utilization of resources. Shore power system loads are susceptible to numerous influencing factors. Therefore, it is crucial to identify a highly accurate load forecasting model to facilitate the judicious allocation of power resources. A short-term shore power system load forecasting model based on the improved dung beetle optimization algorithm (IDBO) and principal component analysis (PCA) in conjunction with the enhanced bidirectional long and short-term memory (BiLSTM) network is proposed in this paper. The IDBO algorithm improves the problem of low convergence accuracy and vulnerability to local optima in DBO. This is achieved by population initialization based on cubic chaotic mapping, amalgamating walrus optimization algorithm, and adaptive t-distribution perturbation strategy. The performance of the BiLSTM, IDBO-BiLSTM, and PCA-IDBO-BiLSTM shore power system load forecasting models are compared through case studies, revealing that the proposed PCA-IDBO-BiLSTM model demonstrates superior predictive capabilities.