The structure of the predictive control system of the test facility "Artificial lungs" is developed. The statement of the task of optimal control of actuating mechanisms of the test facility "Artificial lungs" is formalized: the equation of object control in the form of differential equations is formulated, vectors states, controls, and restrictions on their components are found, optimality criterion in the form of a generalized functional work is determined. The algorithm for forming the task is proposed. The method of solving the problem of optimal control and the algorithm for optimal control of the supply and removal of gases from the system "Artificial lungs-Self-contained breathing apparatus" is chosen. The proposed algorithm will allow controlling gas volumes with a given accuracy and with minimal energy consumption for control.