The ecological environment in arid oasis agricultural areas is fragile. The study on the eco-environmental effect of land use transformation can provide a reference for the optimization of territorial space and the sustainable development of agriculture and rural areas in these regions. Taking Ganzhou District of Zhangye City as an example, the eco-environmental effect and spatial differentiation mechanism of land use transformation in arid oasis agricultural areas were studied by using transfer matrix, eco-environmental quality index, moving window method, ecological contribution rate, and geographical detector model. The results show that: 1) From 1990 to 2020, the production and living spaces continued to expand, the ecological space decreased in general, the land use structure changed from monotonic increase of agricultural space to diversified transformation types, and the functions changed from "ecological transformation to production" to "two-way transformations between production and living, ecological, and production". 2) From 1990 to 2020, the eco-environmental effect of land use transformation was generally positive, and the quality index of villages and towns with large cultivated land area was relatively high. The transformation from other ecological space to forest, grassland, and water areas and agricultural production space has the largest positive ecological effect, and the transformation from forest, grassland and water ecological spaces to other ecological and agricultural production spaces has the largest negative ecological effect. In recent 10 years, the negative ecological effect caused by the excessive expansion of agricultural production space into the forest, grassland, and water ecological spaces is emerging. 3) Population density, per capita GDP, and vegetation coverage are the key factors for the differentiation of eco-environmental quality, while precipitation, land development intensity, proportion of cultivated land area, and per capita water resources are the core factors. The interaction of the factors leading to the trade-off game between the increase of agricultural production space and the compression of forest, grassland, and water ecological spaces produces an adaptive steady-state mechanism, thus forming an overall low eco-environmental quality pattern. The different self-organization, adaptation, and transformation abilities of villages and towns in the face of external interferences lead to different economic development and land use modes, and then shape the differentiated eco-environmental quality pattern of villages and towns.