As the core component of a ship’s engine room, the operation of a marine diesel engine (MDE) directly affects the economy and safety of the entire vessel. Predicting the future changes in the status parameters of a MDE helps to understand the operational status, enabling timely warnings to the engine crew, and to ensure the safe navigation of the vessel. Therefore, this paper combines the temporal pattern attention mechanism with the bidirectional long short-term memory (BiLSTM) network to propose a novel trend prediction method for short-term exhaust gas temperature (EGT) forecasting. First, the Pearson correlation analysis (PCA) is conducted to identify input feature variables that are strongly correlated with the EGT. Next, the BiLSTM network models input feature variables such as load, fuel oil pressure, and scavenging air pressure and capture the interrelationships between different vectors from the hidden layer matrix within the BiLSTM network. This allows the selection of valuable information across different time steps. Meanwhile, the temporal pattern attention (TPA) mechanism has the ability to explore complex nonlinear dependencies between different time steps and series. This assigns appropriate weights to the feature variables within different time steps of the BiLSTM hidden layer, thereby influencing the input effect. Finally, the improved slime mold algorithm (ISMA) is utilized to optimize the hyperparameters of the prediction model to achieve the best level of short-term EGT trend prediction performance based on the ISMA-BiLSTM-TPA model. The prediction results show that the mean square error, the mean absolute percentage error, the root mean square error and the coefficient of determination of the model are 0.4284, 0.1076, 0.6545 and 98.2%, respectively. These values are significantly better than those of other prediction methods, thus fully validating the stability and accuracy of the model proposed in this paper.