First, a mechanical model of a mechanism with two links of variable length in space with holonomic constraints is considered. Its mathematical model is obtained, in the form of Lagrange equations of the second kind. Then we consider a model similar in structure - the number and design of links with a nonholonomic constraint in the form of a skier-snowboarder. The mathematical model of a system of rigid bodies with a nonholonomic constraint is based on the Routh differential equations for a nonholonomic system in generalized coordinates with Lagrange multipliers. A method is developed for constructing differential equations for a system containing nonholonomic constraints using Lagrange equations of the second kind for a model of a similar structure with holonomic constraints. As an example, the model is applied to the description of a skier- snowboarder with two variable-length movable links on one ski. Usually, the control of such systems is implemented on the basis of the method of stabilizing links, however, this article declares methods for controlling mechanical systems based on artificial intelligence systems and outlines approaches to their use in models with nonholonomic links.