The niche theory predicts that environmental heterogeneity and species diversity are positively correlated in tropical forests, whereas the neutral theory suggests that stochastic processes are more important in determining species diversity. This study sought to investigate the effects of soil nutrient (nitrogen and phosphorus) heterogeneity on tree species diversity in the Xishuangbanna tropical seasonal rainforest in southwestern China. Thirty‐nine plots of 400 m2 (20 × 20 m) were randomly located in the Xishuangbanna tropical seasonal rainforest. Within each plot, soil nutrient (nitrogen and phosphorus) availability and heterogeneity, tree species diversity, and community phylogenetic structure were measured. Soil phosphorus heterogeneity and tree species diversity in each plot were positively correlated, while phosphorus availability and tree species diversity were not. The trees in plots with low soil phosphorus heterogeneity were phylogenetically overdispersed, while the phylogenetic structure of trees within the plots became clustered as heterogeneity increased. Neither nitrogen availability nor its heterogeneity was correlated to tree species diversity or the phylogenetic structure of trees within the plots. The interspecific competition in the forest plots with low soil phosphorus heterogeneity could lead to an overdispersed community. However, as heterogeneity increase, more closely related species may be able to coexist together and lead to a clustered community. Our results indicate that soil phosphorus heterogeneity significantly affects tree diversity in the Xishuangbanna tropical seasonal rainforest, suggesting that deterministic processes are dominant in this tropical forest assembly.