The conventional Wilcoxon/Mann-Whitney test can be invalid for comparing treatment effects in the presence of missing values or in observational studies. This is because the missingness of the outcomes or the participation in the treatments may depend on certain pre-treatment variables. We propose an approach to adjust the Mann-Whitney test by correcting the potential bias via consistently estimating the conditional distributions of the outcomes given the pre-treatment variables. We also propose semiparametric extensions of the adjusted Mann-Whitney test which leads to dimension reduction for high dimensional covariate. A novel bootstrap procedure is devised to approximate the null distribution of the test statistics for practical implementations. Results from simulation studies and an economic observational study data analysis are presented to demonstrate the performance of the proposed approach.