Rust diseases of cereals are caused by pathogenic fungi and can significantly reduce plant productivity. Many cultures are subject to them. The disease is difficult to control on a large scale, so one of the most relevant approaches is crop monitoring, which helps to identify the disease at an early stage and make efforts to prevent its spread. One of the most effective methods of control is the identification of the disease from digital images that obtained by a smartphone camera. In this paper, we present a deep learning algorithm that uses a digital image of wheat plants to determine whether they are affected by a disease and, if so, what type: leaf rust or stem rust. The algorithm based on the convolution neural network of the densenet architecture. The resulting model demonstrates high accuracy of classification: the measure of accuracy F1 on the validation sample is 0.9, the AUC averaged over 3 classes is 0.98.