by Martin Guillemet, Sonja LehtinenStrain structure is a well-documented phenomenon in many pathogenic and commensal bacterial species, where distinct strains persist over time exhibiting stable associations between genetic or phenotypic traits. This structure is surprising, particularly in highly recombinogenic species like Streptococcus pneumoniae, because recombination typically breaks down linkage disequilibrium, the non-random association of alleles at different loci. Recent work suggests that multi-locus negative frequency-dependent selection (NFDS) acts to maintain allelic diversity across bacterial genomes, a pre-requisite for the existence of patterns of linkage disequilibrium. Here, using modeling and genomic analysis, we show that multi-locus NFDS can also shape bacterial strain structure through epistatic effects between these loci. We develop models of two NFDS mechanisms – metabolic niche differentiation and competition-colonisation trade-offs – and show how they can produce epistasis. Notably, both models generate frequency-dependent epistasis. Unlike classical constant sign epistasis, this acts to either reinforce or weaken existing linkage disequilibrium, making observed allele associations contingent on the evolutionary history of the population. We then use a dataset of over 3000 S. pneumoniae genomes to test our model predictions, and make observations consistent with frequency-dependent epistatic effects on gene associations. Our results extend and generalise previous theoretical work on the role of antigen-specific acquired immunity (a diversity-maintaining mechanism) on allele associations. Overall, this work contributes to a better understanding of the evolutionary processes shaping the structure of bacterial populations, which is central to predictive modeling of multi-strain pathogens.