Gastric cancer is one of the most common causes of cancer‐related death worldwide. Immunotherapy via programmed cell death protein 1 (PD‐1)/programmed cell death‐ligand 1 (PD‐L1) blockade has shown benefits for gastric cancer. Epigenetic DNA methylation critically regulates cancer immune checkpoints. We investigated how the natural compound oleanolic acid (OA) affected PD‐L1 expression in gastric cancer cells. Interleukin‐1β (IL‐1β) at 20 ng/mL was used to stimulate human gastric cancer MKN‐45 cells. IL‐1β significantly increased PD‐L1 expression, which was abolished by OA. Next, OA‐treated MKN‐45 cells were co‐cultured with activated and PD‐1‐overexpressing Jurkat T cells. OA restored IL‐2 levels in the co‐culture system and increased T cell killing toward MKN‐45 cells. Overexpression of PD‐L1 eliminated OA‐enhanced T cell killing capacity; however, PD‐1 blocking antibody abrogated the cytotoxicity of T cells. Moreover, OA abolished IL‐1β‐increased DNA demethylase activity in MKN‐45 cells. DNA methyltransferase inhibitor 5‐azacytidine rescued OA‐reduced PD‐L1 expression; whereas DNA demethylation inhibitor gemcitabine inhibited PD‐L1 expression, and, in combination with OA, provided more potent inhibitory effects. Furthermore, OA selectively reduced the expression of DNA demethylase TET3 in IL‐1β‐treated MKN‐45 cells, and overexpression of TET3 restored OA‐reduced PD‐L1 expression. Finally, OA disrupted nuclear factor κB (NF‐κB) signaling IL‐1β‐treated MKN‐45 cells, and overexpression of NF‐κB restored OA downregulation of TET3 and PD‐L1. The cytotoxicity of T cells toward MKN‐45 cells was also weakened by NF‐κB overexpression. Altogether, OA blocked the IL‐1β/NF‐κB/TET3 axis in gastric cancer cells, leading to DNA hypomethylation and downregulation of PD‐L1. Our discoveries suggested OA as an epigenetic modulator for immunotherapy or an adjuvant therapy against gastric cancer.