St. John's Wort (Hypericum perforatum) is a perennial herb able to produce water-soluble active ingredients (a.i.), mostly in flowers, with a wide range of medicinal and biotechnological uses. However, information about the ability of arbuscular mycorrhizal fungi (AMF) to affect its biomass accumulation, flower production, and concentration of a.i. under contrasting nutrient availability is still scarce. In the present experiment, we evaluated the role of AMF on growth, flower production, and concentration of bioactive secondary metabolites (hypericin, pseudohypericin, and hyperforin) of H. perforatum under contrasting P availability. AMF stimulated the production of aboveground biomass under low P conditions and increased the production of root biomass. AMF almost halved the number of flowers per plant by means of a reduction of the number of flower-bearing stems per plant under high P availability and through a lower number of flowers per stem in the low-P treatment. Flower hyperforin concentration was 17.5% lower in mycorrhizal than in non-mycorrhizal plants. On the contrary, pseudohypericin and hypericin concentrations increased by 166.8 and 279.2%, respectively, with AMF under low P availability, whereas no effect of AMF was found under high P availability. These results have implications for modulating the secondary metabolite production of H. perforatum. However, further studies are needed to evaluate the competition for photosynthates between AMF and flowers at different nutrient availabilities for both plant and AM fungus.