Plants have evolved complex mechanisms to adapt to nutrient-deficient environments, including stimulating lateral root proliferation into local soil patches with high nutrient content in response to heterogeneous nutrient distribution. Despite the widespread occurrence of this phenomenon in soil, the effect of heterogeneous nutrient distribution on the accumulation of secondary compounds in plant biomass and their exudation by roots remains largely unknown. This study aims to fill this critical knowledge gap by investigating how deficiency and unequal distributions of nitrogen (N), phosphorus (P), and iron (Fe) affect plant growth and accumulation of the antimalarial drug artemisinin (AN) in leaves and roots ofArtemisia annua, as well as AN exudation by roots. Heterogeneous N and P supplies strongly increased root exudation of AN in half of a split-root system exposed to nutrient deficiency. By contrast, exposure to a homogeneous nitrate and phosphate deficiency did not modulate root exudation of AN. This indicates that a combination of local and systemic signals, reflecting low and high nutritional statuses, respectively, were required to enhance AN exudation. This exudation response was independent of the regulation of root hair formation, which was predominantly modulated by the local signal. In contrast to the heterogeneous supply of N and P, heterogeneous Fe supply did not modulate AN root exudation but increased AN accumulation in locally Fe-deficient roots. No modulation of nutrient supply significantly changed the accumulation of AN inA. annualeaves. The impact of a heterogeneous nitrate supply on growth and phytochemical composition was also investigated inHypericum perforatumplants. Unlike inA. annue, the uneven N supply did not significantly influence the exudation of secondary compounds in the roots ofH. perforatum. However, it did enhance the accumulation of several biologically active compounds, such as hypericin, catechin, and rutin isomers, in the leaves ofH. perforatum. We propose that the capacity of plants to induce the accumulation and/or differential exudation of secondary compounds under heterogeneous nutrient supply is both species- and compound-specific. The ability to differentially exude AN may contribute toA. annua’s adaptation to nutrient disturbances and modulate allelopathic and symbiotic interactions in the rhizosphere.