In this paper, we propose a new test for heteroscedasticity of nonlinear regression models using a nonparametric statistic based on pairwise distances between points in a sample. The statistic can be formulated as a U statistic such that U-statistic theory can be applied. Although the limiting null distribution of the statistic is complicated, we derive a computationally feasible approximation for it. The validity of the introduced bootstrap algorithm is proven. The test can detect any local alternatives that are different from the null at a nearly optimal rate in hypothesis testing. The convergence rate of this test statistic does not depend on the dimension of the covariates, which greatly alleviates the impact of the curse of dimensionality. We include three simulation studies and two real data examples to evaluate the performance of the test and to demonstrate its applications.