The article discusses the solution of the spatial traveling salesman problem (TSP 3D variation) using Ant Colony Optimization (ACO). The traveling salesman problem considers n bridges and a matrix of pairwise distances between them. It is necessary to find such an order of visiting cities so that the total distance traveled was minimal, each city was visited exactly once and the salesman returned to the city from which he began his route. In the TSP 3D variation problem, each “city” has 3 coordinates x, y, z. The analysis of the main methods of solving, in particular, the metaheuristic algorithms to which ACO belongs, is performed. At each iteration of these methods, a new solution of the problem is built, which is based not on one, but several solutions of the population. The ACO uses an idea that is based on collecting statistical information about the best solutions. The program code is implemented in MATLAB. During computational experiments, various network topologies were randomly generated, and the number of iterations at which the optimal cycle was achieved was recorded. The execution time of the code for the TSP 3D task is almost the same as the execution time of TSP 2D. The results can be used for spatial tasks of the salesman (TSP 3D-variation), which arise in the process of 3D printing, planning UAV trajectories (UAV) in mountain conditions or multi-story urban development, road planning in multi-story buildings.