Ecological interactions can promote phenotypic diversification in sympatric species. While competition can enhance trait divergence, other ecological interactions may promote convergence in sympatric species. Within butterflies, evolutionary convergences in wing color patterns have been reported between distantly related species, especially in females of palatable species, where mimetic color patterns are promoted by predator communities shared with defended species living in sympatry. Wing color patterns are also often involved in species recognition in butterflies, and divergence in this trait has been reported in closely related species living in sympatry as a result of reproductive character displacement. Here, we investigate the effect of sympatry between species on the convergence vs. divergence of their wing color patterns in relation to phylogenetic distance, focusing on the iconic swallowtail butterflies (family Papilionidae). We developed an unsupervised machine learning-based method to estimate phenotypic distances among wing color patterns of 337 species, enabling us to finely quantify morphological diversity at the global scale among species and allowing us to compute pairwise phenotypic distances between sympatric and allopatric species pairs. We found phenotypic convergence in sympatry, stronger among distantly related species, while divergence was weaker and restricted to closely related males. The convergence was stronger among females than males, suggesting that differential selective pressures acting on the two sexes drove sexual dimorphism. Our results highlight the significant effect of ecological interactions driven by predation pressures on trait diversification in Papilionidae and provide evidence for the interaction between phylogenetic proximity and ecological interactions in sympatry, acting on macroevolutionary patterns of phenotypic diversification.