Background and AimMachine learning is an important branch and supporting technology of artificial intelligence, we established four machine learning model for the drug sensitivity of Klebsiella pneumoniae to imipenem based on matrix‐assisted laser desorption ionization time‐of‐flight mass spectrometry (MALDI‐TOF‐MS) and compared their diagnostic effect.MethodsThe data of MALDI‐TOF‐MS and imipenem sensitivity of 174 cases of K. pneumoniae isolated from clinical specimens in the laboratory of microbiology department of Tianjin Haihe Hospital from 2019 January to 2020 December were collected. The mass spectrometry and imipenem sensitivity of 70 cases of imipenem‐sensitive and 70 resistant cases were randomly selected to establish the training set model, 17 cases of sensitive and 17 cases of resistant cases were randomly selected to establish the test set model. Mass spectral peak data were subjected to orthogonal partial least squares discriminant analysis (OPLS‐DA), the training set data model was established by machine learning least absolute shrinkage and selection operator (LASSO) algorithm, logistic regression (LR) algorithm, support vector machines (SVM) algorithm, neural network (NN) algorithm, the area under the curve (AUC) and confusion matrix of training set and test set model were calculated and selected by Grid search and 3‐fold Cross‐validation respectively, the accuracy of the prediction model was verified by test set confusion matrix.ResultsThe R²Y and Q² of OPLS‐DA were 0.546 and 0.0178. The AUC of the best training set and test set models were 0.9726 and 0.9100, 1.0000 and 0.8581, 0.8462 and 0.6263, 1.0000 and 0.7180 evaluated by LASSO, LR, SVM and NN model respectively. The accuracy of the LASSO, LR, SVM and NN model were 87%, 79%, 62%, and 68% in test set, respectively.ConclusionThe LASSO prediction model of K. pneumoniae sensitivity to imipenem established in this study has a high accuracy rate and has potential clinical decision support ability.