Recognition of handwritten texts in different languages has recently attracted great interest among researchers in connection with the development of various algorithms for machine learning, deep learning and computer vision. This paper proposes a labeling approach for collecting dataset for handwritten Kazakh text recognition (HKTR). We consider the stages of creating a handwritten database for the Kazakh language and preparing a training sample for training a neural network. The results of applying widely used machine learning algorithms for recognizing offline handwritten texts are presented. We evaluate the performance of the proposed method on the test sets from our Kazakh handwritten dataset and Russian handwritten dataset, and achieve performance with correct rate 85.63.