Analyzing the impact of peripheral lipid levels on the efficacy of immune checkpoint inhibitor therapy in non-small cell lung cancer (NSCLC) patient populations and exploring whether it can serve as a biomarker for broadening precise selection of individuals benefiting from immunotherapy. We retrospectively collected clinical data from 201 cases of NSCLC patients receiving immune checkpoint inhibitor therapy. The clinical information included biochemical indicators like total cholesterol, triglycerides, high-density lipoprotein (HDL), and low-density lipoprotein (LDL). We utilized machine learning algorithms and Cox proportional hazards regression models to investigate independent predictors for both short-term and long-term efficacy of immunotherapy. Additionally, we concurrently developed a survival prediction model. Analyzing the Genes of Patients with Treatment Differences to Uncover Mechanisms. Correlation analysis revealed a significant positive association between HDL and ORR, DCR, and PFS. T-test results indicated that the high-HDL group exhibited higher DCR (81.97% vs. 45.57%) and ORR (61.48% vs. 16.46%). Kruskal-Wallis test showed that the high-HDL group had a longer median PFS (11 months vs. 6 months). Utilizing six machine learning algorithms, we constructed models to predict disease relief and stability. The model built using the random forest algorithm demonstrated superior performance, with AUC values of 0.858 and 0.802. Furthermore, both univariate and multivariate Cox analyses identified HDL and LDL as independent risk factors for predicting PFS. In patients with poor immunotherapy response, there is upregulation of BCL2L11, AKT1, and LMNA expression. HDL and LDL are independent factors influencing the survival prognosis of NSCLC patients undergoing immune checkpoint inhibitor therapy. HDL is expected to become new biomarkers for predicting the immunotherapy efficacy in patients with NSCLC. In patients with poor immunotherapy response, upregulation of the LMNA gene leads to apoptosis resistance and abnormal lipid metabolism.