DUBAI  Dubai’s skyline is the most sparkling in the Middle East. But down on the ground, the environmental problems of a quickly erected city built on sand look a lot less alluring.

In the last year, tourists have swum amid raw sewage in Dubai’s slice of the Persian Gulf. The purifying of seawater to feed taps and fountains is raising salinity levels. And despite sitting on vast oil reserves, the region is running out of energy sources to support its rich lifestyle.

The simple basics of waste treatment and providing fresh water, in addition to running major industrial projects, require so much electricity that the region is turning to a nuclear future, raising questions about the risks, both environmental and political, of relying in part on a technology vulnerable to accidents and terrorist attacks.

Dazzled by Dubai’s rapid urbanization, other countries in the gulf are seeking to emulate it, especially as they prepare for a population boom. Dubai offers a cautionary tale in the pitfalls of building metropolises in the parched desert.