Chronic nonbacterial osteomyelitis (CNO) is an autoinflammatory bone disorder. The origin and development of CNO involve many complex immune processes, resulting in delayed diagnosis and a lack of effective treatment. Although bioinformatics analysis has been utilized to seek key genes and pathways in CNO, only a few bioinformatics studies that focus on CNO pathogenesis and mechanisms have been reported. This study aimed to identify key biomarkers that could serve as early diagnostic or therapeutic markers for CNO. Two RNA-seq datasets (GSE133378 and GSE187429) were obtained from the Gene Expression Omnibus (GEO). Weighted gene coexpression network analysis (WGCNA) and differentially expressed gene (DEG) analysis were conducted to identify the genes associated with CNO. Then, the autoinflammatory genes most associated with CNO were identified based on the GeneCards database and a CNO prediction model, which was created by the LASSO machine learning algorithm. The accuracy of the model and effects of the autoinflammatory genes according to receiver operating characteristic (ROC) curves were verified in external datasets (GSE7014). Finally, we performed clustering analysis with ConsensusClusterPlus. In total, eighty CNO-related genes were identified and were significantly enriched in the biological processes regulation of actin filament organization, cell–cell junction organization and gamma-catenin binding. The main enriched pathways were adherens junctions, viral carcinogenesis and systemic lupus erythematosus. Two autoinflammatory genes with high expression in CNO samples were identified by combining an optimal machine learning algorithm (LASSO) with the GeneCards database. An external validation dataset (GSE187429) was utilized for ROC analysis of the prediction model and two genes, and the results indicated good efficiency. Then, based on consensus clustering analysis, we found that the expression of UTS2 and MPO differed between clusters. Finally, the ceRNA network of lncRNAs and the small molecule compounds targeting the two autoinflammatory genes were predicted. The identification of two autoinflammatory genes, the HCG18/has-mir-147a/UTS2/MPO axis and signalling pathways in this study can help us understand the molecular mechanism of CNO formation and provides candidate targets for the diagnosis and treatment of CNO.