Proton exchange membrane fuel cells (PEMFC) are widely acknowledged as a prospective power source, but durability problems have constrained development. Therefore, a compound prediction framework is proposed in this paper by integrating the locally weighted scatter plot smoothing method (LOESS), uniform information coefficient (UIC), and attention-based stacked generalization model (ASGM) with improved dung beetle optimization (IDBO). Firstly, LOESS is adopted to filter original degraded sequences. Then, UIC is applied to obtain critical information by selecting relevant factors of the processed degraded sequences. Subsequently, the critical information is input into the base models of ASGM, including kernel ridge regression (KRR), extreme learning machine (ELM), and the temporal convolutional network (TCN), to acquire corresponding prediction results. Finally, the prediction results are fused using the meta-model attention-based LSTM of ASGM to obtain future degradation trends (FDT) and the remaining useful life (RUL), in which the attention mechanism is introduced to deduce weight coefficients of the base model prediction results in LSTM. Meanwhile, IDBO based on Levy flight, adaptive mutation, and polynomial mutation strategies are proposed to search for optimal parameters in LSTM. The application of two different datasets and their comparison with five related models shows that the proposed framework is suitable and effective for forecasting the FDT and RUL of PEMFC.