The accurate pathological diagnosis of endometrial cancer (EC) improves the curative effect and reduces the mortality rate. Deep learning has demonstrated expert-level performance in pathological diagnosis of a variety of organ systems using whole-slide images (WSIs). It is urgent to build the deep learning system for endometrial cancer detection using WSIs. The deep learning model was trained and validated using a dataset of 601 WSIs from PUPH. The model performance was tested on three independent datasets containing a total of 1,190 WSIs. For the retrospective test, we evaluated the model performance on 581 WSIs from PUPH. In the prospective study, 317 consecutive WSIs from PUPH were collected from April 2022 to May 2022. To further evaluate the generalizability of the model, 292 WSIs were gathered from PLAHG as part of the external test set. The predictions were thoroughly analyzed by expert pathologists. The model achieved an area under the receiver operating characteristic curve (AUC), sensitivity, and specificity of 0.928, 0.924, and 0.801, respectively, on 1,190 WSIs in classifying EC and non-EC. On the retrospective dataset from PUPH/PLAGH, the model achieved an AUC, sensitivity, and specificity of 0.948/0.971, 0.928/0.947, and 0.80/0.938, respectively. On the prospective dataset, the AUC, sensitivity, and specificity were, in order, 0.933, 0.934, and 0.837. Falsely predicted results were analyzed to further improve the pathologists' confidence in the model. The deep learning model achieved a high degree of accuracy in identifying EC using WSIs. By pre-screening the suspicious EC regions, it would serve as an assisted diagnostic tool to improve working efficiency for pathologists.