In order to study the application of natural language processing (NLP) technology in artificial intelligence (AI) scene of law, NLP technology is used to construct a legal AI retrieval system and further simulate the system. Then, by inputting the subject matter of the case into the system, the system’s accuracy, recall rate, and error rate and other related indicators are evaluated, to analyze the performance of the legal retrieval system. The results show that in the case analysis of a single theme, the accuracy rate of the case with the theme of “impeding police enforcement” is low, and the accuracy rate of the other theme cases is over 70%, and the highest accuracy rate even reaches 95%. In the case retrieval analysis of multitheme, the accuracy rate of case retrieval is improved, higher than 75%, and the zero-detection rate is significantly reduced with the increase in keywords. In the analysis of network case retrieval, the average correct rate of the overall case retrieval will be nearly 65%. Further tests on its reliability show that during the continuous week of the retrieval test, the system has no faults and passed the reliability test. Therefore, through this study, it is found that the application of NLP technology in the legal AI retrieval system has a reliable accuracy, which meets the expectation of this paper.