In the complex global food system, the dynamics associated with international food trade have become crucial determinants of food security. In this paper, we employ a community detection approach along with a supervised learning technique to explore the evolution of communities in the agri-food trade network and to identify key factors influencing their composition. By leveraging a large dataset that includes both volume and monetary value of trades, we identify similarities between countries and uncover the primary drivers that shape trade dynamics over time. The analysis also takes into account the impact of evolving climate conditions on food production and trading. The results highlight how the network’s topological structure is continuously evolving, influencing the composition of communities over time. Alongside geographical proximity and geo-political relations, our analysis identifies sustainability, climate and food nutrition aspects as emerging factors that contribute to explaining trade relationships. These findings shed light on the intricate interactions within the global food trade system and provide valuable insights into the factors affecting its stability.