With the development of intelligent transportation systems, platooning can reduce vehicle aerodynamic drag by decreasing spacing between vehicles, improving transportation efficiency and reducing emissions. However, it is difficult for existing models to enable dynamic adjustment and real-time feedback. Therefore, this study proposes a digital twin system for real-time drag coefficient prediction using stacking ensemble learning. First, 2000 datasets of pressure distributions and drag coefficients under varying spacings were obtained through simulations. Then, an online prediction model for the aerodynamic performance of platooning vehicles was then constructed, realizing real-time drag coefficient prediction, and verifying the model performance using computational fluid dynamics data. The results indicate that the model proposed achieves 98.56% prediction accuracy, significantly higher than that of the traditional BP model (75.78%), and effectively captures the nonlinear relationship between vehicle spacing and drag coefficient. The influence mechanism of vehicle spacing on the aerodynamic performance of platooning vehicles revealed in this study enables high-precision real-time prediction under dynamic parameters.