Before I arrive in Dubai, I meet 'Clare' on an expat website who insists I visit her at her home in the Meadows, a housing development in the city's suburbs - 'to give you an idea of how so many people get misled into thinking they are in Milton Keynes'. Half an hour in a taxi later, past the skyscrapers, and the construction sites, and the six-lane highways, and minibuses of Indian and Pakistani workers being shuttled from one project to another, I'm in a straight-out-of-a-David-Lynch-film picture-perfect suburban road lined with picture-perfect suburban villas.

And there's Clare. 'That's what I wanted you to see!' she says before I'm even out of the car. 'Look at that.' I'm looking at a wheelie bin and not really understanding her point. 'People see the wheelie bin and they think it's all familiar, and normal, and therefore nothing bad can happen. Ha!'

The Meadows is a gated enclave with a uniformed security guard and lush green landscaping, and Clare is a British expatriate wife whose husband is a contractor. To all intents, they're living what looks very much like the good life: there's a pool in the back garden, year-round sun, and in the living room Sky News is on.

'Oh yes, it looks good, doesn't it? But we've all made a pact with the devil to be here. You get the tax-free salary, but in return you have to give up all your rights. There's no accountability, no transparency, no rule of law. There's no legislative body. Very few employment rights. It looks like a modern country, but it takes more than a few skyscrapers to create one of those. Scratch the surface and it's a different story. And if you're a silly young girlie who gets into trouble, then forget it.'

There's a particular silly young girlie Clare is referring to: Michelle Palmer, a 36-year-old advertising executive who in July this year was arrested for allegedly having sex on a beach with Vince Acors, a 34-year-old visiting company director from Kent.

It's been a tabloid sensation. Palmer's 'Bridget Jones' lifestyle endlessly examined; at least a dozen conflicting versions of the story printed - they did have sex, they didn't have sex, Palmer may or may not have waved her shoe and called the policeman 'a fucking Muslim' - the case comes to court this week and the prosecution is said to have concrete DNA evidence to prove they didn't have sex, but beyond that, almost nothing is certain other than the fact that, if convicted, they both face up to six years in jail.

And whatever the verdict, Palmer has already lost her job - with the publishers ITP which produces Time Out Dubai and whose chairman is Andrew Neil; but then there's no such thing as unfair dismissal in the United Arab Emirates - and been mauled in the press. The Daily Mail is in strict accordance with sharia law on this point: it's the woman's shame.

In Dubai, it's shocked the local population and split the expat community between those who feel sympathy and those who think she deserves nothing less than a stoning.

'What I can't believe,' says Clare, 'is the amount of venom directed towards her. The reaction here has been unbelievable. I think people are under such pressure. They know it's not the dream. And they need a scapegoat. The fact is that if you can ascribe blame to someone else's misfortune, then you are indemnifying yourself against it happening to you.'

There are a lot of Brits in Dubai. A lot of people that it, or something similar, could have happened to. People who don't much want to contemplate how the judicial system works (at best haphazardly, at worst unequally), or how long you can be detained without trial (months at a time) or what the British embassy will do to help you (not a lot). In the past year, 230 Britons have found themselves imprisoned for offences ranging from driving under the influence to bouncing a cheque.

It's a minimum four-year term if any trace of drugs is found on you: the Radio One DJ Grooverider, caught with 2.16g of cannabis, spent 10 months inside before being pardoned two weeks ago, and Cat Le-Huy, a producer with Endemol, spent three weeks in jail without being charged, for possession of Melatonin - jetlag pills.

The Palmer-Acors case is about much more than any of this, though. It's exposed the very contradiction that has made modern Dubai what it is: a tolerant haven in an intolerant region. And it's the tension between the two Dubais: the socially conservative society whose penal code is based on sharia; and the other Dubai, the increasingly visible Dubai, whose numbers are growing with every fresh planeload of people who land at the airport and wear crop tops to the mall and drink shooters in the bars.

It's to Dubai's enormous credit that these two halves have so far been accommodated side by side, but the strain has started to tell. When I visited last week, it was Ramadan and the restrictions in Dubai are far harsher than in any other Arab country I've visited. Eating and drinking during daylight hours is illegal; even for non-Muslims, having a sip of water can mean a jail sentence. I got the timing of my trip all wrong. I'd wanted to check out the Friday 'brunch' scene, all-day boozeathons which provided the setting for the Palmer-Acors romance, and I email the editor of an English language newspaper in a panic.

'Don't worry,' he emails back. 'You'll see plenty.' And it's true: I can't drink coffee at the Starbucks next to my hotel, food is only served in a curtained-off enclave, and the clubs are closed - a DJ called Michael Robert describes the usual scene as 'like Ibiza but minus the drugs, the fights and the aggro'. But after 7.30pm, all across the city, in any number of bars, it's like downtown Croydon at closing time on a Friday night.

At Long's Bar, it's a crush of short skirts and spaghetti straps - alcohol is illegal if you're a local, and practically a social obligation if you're not. And afterwards, a local journalist takes me on a tour of 'the dark side', taking in a hooker bar in a four-star chain hotel. Prostitution is illegal, but absolutely blatant - every shape, size, nationality, ethnicity and possible aesthetic taste catered for.

But then, somehow Dubai manages to be all things to all people. It's capitalism's ultimate expression: the land of opportunity, the most developed city in the Middle East, a free port. It's ruled absolutely by Sheikh Mohammed bin Rashid Al Maktoum and is a constituent part of the UAE, a federation of seven emirates, including, down the road, immensely oil-rich Abu Dhabi, whose ruling family has just bought Manchester City. Dubai, on the other hand, never had much oil; it's been forced to develop in other ways, to provide whatever is needed, and it's done so more quickly and successfully than anyone could anticipate. It knows what the rest of the world wants and has built it before anyone else has even realised.

Alexander McNabb, a PR executive and the writer of a blog called Fake Plastic Souks, arrived 15 years ago, when 'it was still a village, a strange and very foreign place'. It was the entrepôt of the Gulf and its R'n'R facility, where oilmen came to relax - they knew the rules and relished the freedom. It's this that's changed. There are now 100,000 Brits living and working in Dubai. And last year 1.1m UK tourists visited - despite summer temperatures of 50C plus, it's now the second most popular long-haul destination after Florida. And the ways in which the city is changing are in many ways a reflection of Britain itself.

Now, says McNabb, 'you drive your western car to your western office. At the weekends you go to the western hotels and have your western buffets and western-style beach club, and it's quite easy to ignore the fact that you're abroad.'

He's right. It is easy. It's four days before I hear any actual Arabic. Most remarkably of all the remarkable things about Dubai is that it's occupied almost entirely by foreigners: native Emiratis make up barely 20 per cent of the population. They're a minority in their own country.

When I meet Sultan Al-Qassemi, a businessman and journalist, he points out that the Emiratis are handling this rather better than the British would. 'Can you imagine? It's the equivalent of there being 55m foreigners in Britain, and just 5m of you. It's a unique case, and I think we deserve extra credit for the way we are handling it. The country is completely open. It is a utopia! Anyone can come here! We are one of the most tolerant countries in the world. And all this has happened in a single generation. Thirty years ago, it was desert.'

He sends me down the road, to the Sheikh Mohammed Centre for Cultural Understanding and I arrive in time for iftar - the breaking of the fast. There's a group of expats and we're given dates and water, and then platters of home-cooked food are brought while young Emiratis tell us about their culture. It's fascinating: they're so friendly, and articulate and welcoming. 'It's so difficult to meet Emiratis, to talk to them. In a year, I haven't properly met one,' a British woman named Paula tells me.

Khulooda, a bright and sparky 21-year-old in a fringed abaya, tells me she's studying marketing and tourism. She thinks people maybe need to do a little more research about the country before they arrive. That maybe people should wear more appropriate clothing when they go to the mall. That Palmer and Acors should have known better. I think maybe she's right. And I hope, for her sake, that she goes into some other industry instead.

A decade ago, who had even heard of going on holiday in Dubai? But what Dubai has proved is that if you build it, they will come. For if there's one thing Dubai can do, it's build: one third of the world's cranes are here at any one time, most of them directly outside of my hotel window. I try and count them but give up at 70. The highest is perched a kilometre up in the air, on the top of the Burj Dubai, already the tallest building in the world, and it's not yet finished. Next month, the biggest shopping mall in the world will open, the Dubai Mall, and shortly you'll be able to fly into the world's biggest airport - six runways and the size of Hong Kong island. What's more, if you stay in your hotel, you need never even know you're in an autocratic Islamic state where it's illegal to hold your wife's hand in public, or be gay, or found with 0.003g of cannabis - less than a grain of sugar - on the sole of your shoe, as Keith Brown was, a youth worker from the West Midlands who was sentenced to four years in jail.

But the hotels are wonderful. And even the Observer's modest budget runs to a five-star number. I'm on the 35th floor, with vertiginous views down, vertiginous views up. It's slightly queasy-making, more so after I talk to Chris Davidson, a Gulf political expert based at Durham University.

Two of the 9/11 hijackers were from the UAE, he tells me. And every weekday, the malls are full of able-bodied young men simply hanging out. 'They're the first generation who've had this cradle-to-grave security, who receive a house from the government and money to get married, who've not known hardship or what it is not to have air conditioning. How are they reacting to what they see happening to their country? And if something did happen here, tourism would collapse overnight. Real estate would collapse. Dubai is so fragile. It's the result of a global boom and it's never properly been put to the test.'

Economically, nobody's sure how it will weather the global crisis. The region is awash with ever-increasing petrodollars, but Dubai's construction projects are highly leveraged. And culturally, tourism is Dubai's great unmentionable can of worms, its fault line. A blogger, who'll only identify herself as Secret Dubai, tells me Dubai's marketing machine has deliberately created 'the false sense of westernness, of a trashy holiday resort'. And, according to Davidson, it's reached 'a critical mass. Previously people were corralled into five-star enclaves; what the Palmer-Acors case shows is that they're starting to leak out.'

The week I visit, Atlantis opens - a mega resort owned by Sol Kerzner, the South African who gave the world Sun City. It's a vast pink edifice that looks like something Katie Price might design, built on an artificial island shaped like a palm tree.

It's actually only one of three palms under construction, which together will add 520km of beaches to Dubai's coastline, and where the Beckhams are alleged to have 'bought' a villa, along with Rio Ferdinand and Michael Owen. It's all PR, but then nowhere in the world wants the Beckhams to love it as much as Dubai. It's more of a WAG than almost any other place on earth: flashy, artificially enhanced, desperate to please, all things to all people.

I tour the resort and dutifully write down the stats: $1.5bn to build,1,539 rooms, a Nobu and a Locatelli restaurant, a $25,000-a-night suite, 65,000 marine animals, a 1.4km beach.

Do you think most tourists even know it's Ramadan, I ask.

'That's a good question,' says the PR, a South African. 'I think they receive information at the airport.'

Actually, they don't, I say. We ponder this for a moment, and then she tells me about what a wonderful life she's had since she moved there.

Back in the Meadows, Clare invites me to an expat ladies' coffee morning. It's not an obvious place to go and meet a hotbed of radical malcontents. The lawns are neat, the communal pool still inviting. And yet... Nobody's managing to save. Rents are sky high: £45,000 a year for a modest villa, paid in advance. And you can't move jobs: your visa is sponsored by your employer.

Jane says: 'If I knew now what I knew then, I just wouldn't have come.' She's spent months and months trying to get her daughter with mild ADHD into any sort of school. Laura bought a house, in a 'lovely, quiet, very green development' and the road in front of it has just been torn up to build a six-lane highway. And Rebecca, who's lived in Dubai for 13 years, tells story after story of the Dubai-dream-gone-wrong.

'People just don't know what they're getting themselves into,' she says. 'There's no social infrastructure, no safety net, nothing.' You don't even have to do anything wrong; a bad case of bad luck is enough. She puts me in touch with Richard, a twinkly fortysomething who came to Dubai as a salesman with a multinational company. 'And then, in one month, I had a car accident, lost my job, and my marriage fell apart.'

Richard fell behind on his car payments, his bank loans, his credit cards. 'Everybody lives beyond their means here. It's all front. It's like Dubai - a totally false appearance to what it actually is.' He was charged by the police with defaulting on his loans and his passport was confiscated. 'So I couldn't get another job and I couldn't pay the debt, and I couldn't leave the country... and to cut a very long story short, I got 12 months.'

It's quite a story. He's only been out two weeks, but he's still managing just about to smile. But not even the judges are Emiratis: they're on short-stay visas like everyone else, and the only thing he had going in his favour, he says, is that he wasn't Asian. 'Tons of them are in for practically nothing: jaywalking or owing £10.'

All over Dubai you see construction workers outside in the searing heat. They're the ones building Dubai - they live in what are openly called 'labour camps', have very often paid hundreds of dollars to an agency for a visa and are trapped for years until they've paid off the debt. The 7,500 workers on the Burj Dubai are paid $7.50 a day; unskilled ones $4. It's how globalisation works, of course. We get to buy our cheap Primark tops because in a factory far, far away somebody isn't paid very much to make them. But in Dubai, you see it every time you step outside.

Nick McGeehan, founder of an organisation called Mafiwasta, tells me it's more than that. 'The difference is that the salaries paid in sweatshops in foreign countries reflect the economic weakness of that country. Furthermore, the people who work in them go home to their families at night.'

He was an oil contractor but was so appalled at the plight of these workers that he set up Mafiwasta and is attempting to make a legal case that the UAE government is complicit in these workers' enslavement. He forwards an email to me he's recently received from an Indian recruitment agent. She's trying to help 133 men she sent to Dubai to fulfil a contract who haven't been paid, whose passports have been confiscated, who are not just living in inhumane, insanitary conditions but had been denied even basic necessities such as drinking water.

'It's very unusual for an agent to come forward, and even more so to have one who actually cares about what happens to the workers,' says McGeehan. The only recourse, he tells her, is to get it in the newspapers...

Both Secret Dubai and Chris Davidson have fallen foul of the UAE's censorship laws. The Secret Dubai blog, winner of a Webby award, is blocked - along with My Space, Flickr and Friends Reunited - and Davidson's recently published book Dubai: The Vulnerability of Success was, like Harry Potter, banned, although the ban has now been lifted.

Mostly though, the authorities rely on editors to self-censor - an even more effective weapon. 'I defy a journalist who has been here a few months, who has got their child into a school, to rock the boat,' says Davidson. I interview a high-profile Emirati academic, and later he rings me up and says: 'You're not going to write anything... critical, are you? Our culture is different from yours, you see. But I didn't say anything negative, did I?'

He points me, as several others do, toward Abdulkhaleq Abdulla, a professor of political science at Emirates university, and possibly the most outspoken person in the country. 'He says really quite remarkable things,' the other academic tells me. 'And he gets away with it. It's very surprising.'

Maybe he's fearless. Or maybe it is, as he says, that others need to be braver. 'We have to have more accountability of the government, more criticism of the policies. More talk about our future and where we are going. Dubai is an amazing place. We are so much further ahead than the rest of the Middle East, but we can't be first on social indicators and last on political ones... It's an embarrassment.'

Even more than that, he says, the place needs to take a long, hard look at itself. Because in 2015, he estimates, Emiratis will make up 10 per cent of the population. And in 2025, at the same rate of growth, zero per cent. 'At the moment when we have everything, we're in danger of losing it all - our very identity.'

I don't go out of my way to track Palmer and Acors down. The case is being heard this week so it's a particularly sensitive time for them. And anyway, they're not really the story. They were drunk and foolish and they might pay an exceedingly high price for their actions, but more than anything else they're simply fallout from an ideological schism that is not of their making.

I don't look for them, but almost everyone I meet is acquainted with one or both of them. Palmer has been in hiding for the past two months, reportedly suffering from anxiety and panic attacks. And Acors? He's there in Long's Bar when I visit. In fact, he's not just in the same bar, he's standing drinking with the same group of friends.

I'm all set to question him, but his friends take me aside: 'He's just an ordinary bloke. He won't talk to you. Just leave him alone.' So I do. It's true, he's just an ordinary bloke. In an extraordinary place. At precisely the wrong moment in time.

· This article was amended on Monday October 13 2008. In the article above, we mentioned the forthcoming opening in Dubai of the 'biggest shopping mall in the world' and incorrectly named it the Mall of Arabia; it is, in fact, the Dubai Mall. This has been changed.