Optimization, digitalization and robotization of oil and gas technological processes based on the use of artificial intelligence methods are among the prevailing trends of the 21st century. The drilling industry is a prime example of these phenomena. The vector of oil and gas drilling is shifting towards complex objects. The improvement of well drilling technologies allows drilling in geological conditions where it was previously impossible. The construction of wells leads to disruption of the natural thermodynamic and stress-strain state of rocks. It is necessary to take into account all the processes occurring in the well and the near-wellbore zone during drilling for the timely recognition of the onset of various complications and accidents. The average time to eliminate complications and accidents is 20-25% of the total well construction time. The task of reducing this indicator is highly relevant. To solve this problem, the most modern technologies are involved, including machine learning algorithms. The main difficulties encountered when using these technologies are the requirements for artificial neural networks for the minimum necessary number of complications or their representable set for the correct "training" of these networks. This report describes how this problem was solved using a full-scale drilling simulator. The drilling simulator makes it possible to recreate a digital twin of a real well and simulate an almost unlimited number of complications of various kinds on it. This approach allows you to create a sample of the required size for the most efficient training and testing of neural network algorithms. Three groups of complications (stuck-pipe or sticking, loss circulation, kick or gas-oil-water occurrence) and standard drilling operations were simulated to minimize the number of false alarms. A total of 86 experiments were modeled, which were then processed using neural network algorithms. The study revealed that the model of an artificial neural network for predicting future manifestations of complications in the form of the "kick or gas-oil-water occurrence", due to its complexity, is trained more efficiently when using not only the input values of drilling parameters, but also the output results of some auxiliary machine learning models. The latest models are trained to solve both regression problems of the indicator function with the model setting to track changes in certain parameters, and the problem of identifying abnormal situations during drilling in real time. When this module trains an artificial neural network model to detect a pre-accident situation of "kick or gas-oil-water occurrence", the following results were obtained for accuracy: accuracy – 0.89, weighted average f1-score – 0.86. The developed system informs the driller about a possible complication with high accuracy, which allows him to avoid it or minimize the consequences.