Modernization of the agricultural sector is based on the transition to "smart agriculture". The intellectualization of agricultural technology management is of greatest interest to science and practice. At the same time, expert systems in which control decisions are made through knowledge bases (KB) are most effective. In this work, knowledge bases are formed using analytical control systems located in data processing centers. Such knowledge bases are transferred to local consumers, who make local control decisions based on them. The purpose of this work is to develop a theoretical basis for solving the problem of intelligent management of the state of agrocenoses containing crops of main crops and weeds. Solving this problem aims to address the limitations of the current paradigm of separate crop and weed management. The application of mineral fertilizers simultaneously stimulates the growth and development of agricultural plants and weeds, and treatment with herbicides simultaneously suppresses the growth of both agricultural plants and weeds. As a result, this leads to significant crop losses and excessive consumption of fertilizers and herbicides. In the presented work, for the first time, the problem of managing agrocenoses is raised and solved at the program level, implemented during one growing season. At this level of management, programs are formed that represent a sequence of technological operations for the application of mineral fertilizers, irrigation and herbicide treatments, ensuring the achievement of a given crop yield. To solve this problem, the previously developed theory modified mathematical models of the state of cultivated crops, reflecting the influence of herbicides. In addition, a model of the state parameters of the dominant weed species was introduced into the control problem, which, in addition to the doses of herbicide treatments, also reflects the influence of mineral fertilizers. The problem is solved using the example of sowing spring wheat as part of agrocenoses.