Unicellular eukaryotic phytoplankton, such as diatoms, rely on microbial communities for survival despite lacking specialized compartments to house microbiomes (e.g., animal gut). Microbial communities have been widely shown to benefit from diatom excretions that accumulate within the microenvironment surrounding phytoplankton cells, known as the phycosphere. However, mechanisms that enable diatoms and other unicellular eukaryotes to nurture specific microbiomes by fostering beneficial bacteria and repelling harmful ones are mostly unknown. We hypothesized that diatom exudates may attune microbial communities and employed an integrated multi-omics approach using the ubiquitous diatom Asterionellopsis glacialis to reveal how it modulates its naturally associated bacteria. We show that A. glacialis reprograms its transcriptional and metabolic profiles in response to bacteria to secrete a suite of central metabolites and two unusual secondary metabolites, rosmarinic acid and azelaic acid. While central metabolites are utilized by potential bacterial symbionts and opportunists alike, rosmarinic acid promotes attachment of beneficial bacteria to the diatom and simultaneously suppresses the attachment of opportunists. Similarly, azelaic acid enhances growth of beneficial bacteria, while simultaneously inhibiting growth of opportunistic ones. We further show that the bacterial response to azelaic acid is widespread in the world’s oceans and taxonomically restricted to a handful of bacterial genera. Our results demonstrate the innate ability of an important unicellular eukaryotic group to modulate their microbial consortia, similar to higher eukaryotes, using unique secondary metabolites that regulate bacterial growth and behavior inversely in different bacterial populations.