The invention discloses application of 1,2,3,4,6-pentagalloylglucose, or an optical isomer, or a racemate, or a solvate, or a pharmaceutically acceptable salt in the preparation of drugs for the treatment or prevention of renal cancer or prostate cancer. According to the application, an experiment shows that the 1,2,3,4,6-pentagalloylglucose can significantly reduce the cell activity of Renca renal cancer and RM-1 prostate cancer in vitro, can reduce the tumor weight of tumor bearing mice in vivo, and it is proved that the 1,2,3,4,6-pentagalloylglucose has an inhibitory effect on two kinds oftumors, and PD-L1 gene expression is detected in two kinds of tumor bearing mice, so that it can be preliminarily inferred that the 1,2,3,4,6-pentagalloylglucose may play an anti-tumor role mainly byblocking PD1/PD-L1.