Elucidating the variation of allocation pattern of ecosystem net primary productivity (NPP) and its underlying mechanisms is critically important for understanding the changes of aboveground and belowground ecosystem functions. Under optimal partitioning theory, plants should allocate more NPP to the organ that acquires the most limiting resource, and this expectation has been widely used to explain and predict NPP allocation under changing precipitation. However, confirmatory evidence for this theory has mostly come from observed spatial variation in the relationship between precipitation and NPP allocation across ecosystems, rather than directly from the influences of changing precipitation on NPP allocation within systems. We performed a 6‐yr five‐level precipitation manipulation experiment in a semiarid steppe to test whether changes in NPP allocation can be explained by the optimal partitioning theory, and how water requirement of plant community is maintained if NPP allocation is unaltered. The 30 precipitation levels (5 levels × 6 yr) were divided into dry, nominal, and wet precipitation ranges, relative to historical precipitation variation over the past six decades. We found that NPP in both aboveground (ANPP) and belowground (BNPP) increased nonlinearly as precipitation increased, while the allocation of NPP to BNPP (fBNPP) showed a concave quadratic relationship with precipitation. The declined fBNPP as precipitation increased in the dry range supported the optimal partitioning theory. However, in the nominal range, NPP allocation was not influenced by the changed precipitation; instead, BNPP was distributed more in the surface soil horizon (0–10 cm) as precipitation increased, and conversely more in the deeper soil layers (10–30 cm) as precipitation decreased. This response in root foraging appears to be a strategy to satisfy plant water requirements and partially explains the stable NPP allocation patterns. Overall, our results suggest that plants can adjust their vertical BNPP distribution in response to drought stress, and that only under extreme drought does the optimal partitioning theory strictly apply, highlighting the context dependency of the adaption and growth of plants under changing precipitation.