Addressing the issue of carbon emissions in the transportation sector, this research constructed various predictive models using multiple machine learning algorithms based on panel data from 30 provinces in China from 2005 to 2019. The study aimed to identify the optimal machine learning algorithm and key factors influencing the carbon emissions of transportation, providing potent references for policymakers and decision-makers to reduce carbon emissions and promote the sustainable development of the transportation sector. Initially, drawing from the concept of the fixed effects model, we included the heterogeneity differences among provinces as an important factor. We further employed a combined method of Pearson's correlation coefficient and Spearman's rank correlation coefficient to screen 18 factors influencing transportation carbon emissions. We then made a preliminary selection of seven common machine learning algorithms and used the screened factors as explanatory variables for model training. The three algorithms with the best performance were further optimized and trained. Subsequently, we utilized the K-fold cross-validation method; plotted learning curves to test the performance of each predictive model; and used MSE, MAE,