The metabolic function of microbial communities emerges through a complex hierarchy of genome-encoded processes, from gene expression to interactions between diverse taxa. Therefore, a central challenge for microbial ecology is deciphering how genomic structure determines metabolic function in communities. Here we show, for the process of denitrification, that community metabolism is quantitatively predicted from the genes each member of the community possesses. Quantifying metabolite dynamics across a diverse library of bacteria enables a regression approach that reveals a sparse mapping from gene content to metabolic phenotypes. A consumer-resource model then correctly predicts community metabolism from the metabolic phenotypes of each strain in the collective. Our results enable connecting metagenomes to metabolite dynamics, designing denitrifying communities and discovering how genome evolution impacts metabolism.