Cancer immunotherapy is an emerging anti-cancer strategy that enhances immune circulation by targeting the immune system. Among the various targets, HPK1, a member of the mammalian Ste20-like protein serine/threonine kinase family, serves as a crucial negative regulator of immune-mediated mechanisms, positioning it as a promising target for immunotherapy. Herein, based on the reported HPK1 inhibitors characterized by 2,4-diaminopyrimidine components, four series of derivatives were obtained through structural optimization methods. Compound 10c demonstrates significant inhibitory effects on HPK1 kinase, with an IC50 of 0.09 nM. Additionally, it markedly inhibits the phosphorylation of the downstream adaptor protein SLP76, with an IC50 of 33.74 nM, and effectively stimulates the secretion of the T cell activation marker IL-2, exhibiting an EC50 of 84.24 nM. These findings suggest that compound 10c holds considerable promise for applications in immunotherapy.