Detection of medical insurance fraud is of significant research importance. Currently, most methods focus on supervised data, but identifying gang fraud requires exploring relationships among gang members, for which labeled data cannot be obtained in advance, this makes unsupervised models more suitable. In this paper, we propose an unsupervised model based on knowledge graph and the Louvain algorithm for identifying medical insurance gang fraud. Firstly, a knowledge graph is constructed based on medical records using the NetworkX algorithm to establish a knowledge graph of anti-gang fraud in medical insurance, facilitating the summarization of risk rules after community division. Then, the Louvain algorithm is applied to the patient–doctor relationship network to discover communities, and then we divide the entire knowledge graph into four levels of communities with high, medium, low, and no apparent risk, respectively. Different measures are proposed for communities with different risk levels for supervision. To demonstrate the superiority of the proposed model, it is compared with other unsupervised models on multiple datasets for gang fraud identification. By comparing the correct partition rate, the superiority of the proposed model in the research of medical insurance gang fraud identification is demonstrated, providing an effective unsupervised learning method for identifying medical insurance gang fraud, facilitating the proposal of prevention and control measures, and preventing fraudulent incidents.