As embassies and oil companies expand here and as new Western firms set up under Egypt's open-door policy, there are more and more Americans and Europeans seeking respite from over-crowded and proverty-stricken surroundings.

The find themselves in a teeming city where the telephones work only fitfully, the traffic is maddening, the bureaucracy is endlessly frustrating and the pollution is choking. There are few golf courses, tennis courts are available only in private clubs and there are no parts that resemble anything in America or Europe.

Furthermore, the Mediterranean beaches are 2 1/2 hours away on a treacherous road through the desert and there are few hotels up to Western standards in Alexandria or the beach resorts near it.

So, many Americans and Europeans have turned to the one source of recreation unique to the Arab world - the fabled Arabian horses and the austere desert that traps the Egyptian masses in the Nile Valley.

For a fee that is modest for Westerners but prohibitive to most Egyptians, good-quality horses can be rented for a jaunt across the unspoiled desert and a headlong gallop up the huge sand hills that border the green farmland along the Nile. From high up on the hills, Cairo is spread out like a garden city and the desert wind carries away all remnants of the city's pollution.

The stables are at the foot of the pyramids and sphynx of Giza, which lend a sense of grandeur and timelessness to the outing. On a clear day, a row of even older pyramids can be seen in the distance stretching to the south along the Nile.

Executives, diplomats, bankers, their wives and children - many people of every age eventually give riding a try if not for the love of horses them for the escape riding provides.

"You might say it is for my sanity," explained the wife of a high-ranking European diplomat. When she began riding, the woman warned her teacher, Abdul Nabi, that she would be his first failure, but more than two years later she is still at it and improving steadily.

"It's just the glamour of riding out in the desert and around the pyramids. It's cheap and it is one of the easy things one can do here. It doesn't involve much hassle and the family can do it together," said Patti Steele, wife of the No. 2 man at the Australian embassy. Her husband, Rory, also started riding in Cairo and rides every week with their two children.

"The more you go, the better horses they give you," Mrs. Steel said. Like beginners everywhere, Mrs. Steele fell once and found the sand "not as solid as you'd imagine, but not a soft as you'd imagine either."

For Anna Green, the attraction is the horses. "I'd been on a horse before but I hadn't actually ridden," she said. "Mind you, I'd always wanted to ride. The Arabian horses are so lovely. They're gentle and they're intelligent. Also there's the sense of freedom. You get up on the horse and you go."

Mrs. Green's husband, Gavin, general manager and director of Cairo Barclay's International Bank, started more slowly, "Gavin was terrified. He's started here and he's completely taken in with it," she said. Both Greens have leased horses for their private use from one of the two major stables near the pyramids. It cost about $35 a month to lease a horse but the stables prefer to lease for six months to a year at a time.

For some, riding fulls the place of a weekly bridge game as a social event. A number of groups meet for a "lesson" of trotting and cantering in single file in circles or in and out among the file in circles or in and out among, the palm trees that border the valley farmland. After half an hour of that there is an exhilarating gallop up to the top of the sand hills and oftern a stop for a small glas sof hot sweet Arab tea.

While the ambiance isn't exactly that of the Virginia hunt country, riding in Egypt is also a very relaxed and casual thing. "There's no snobbism attached to it at all," said Hilary San-severino, the British wife of a an Italian diplomat. "It's different from England. You had to wear jodpurs, a yellow polo neck sweater, a hat and string gloves."

The rider's attire is very much a matter of personal taste. "You see a few jackets and jodpurs, but very seldom," said Carin Lindquist, wife of a Swedish journalist. "They have these boots made here. They are not the very slim ones you find in Scandinavia." Most people just wear jeans and a blouse, sweatshirt or halter top, depending on the weather.

There is always a sense of adventure in sallying forth on something as unreliable as high-spirited horse. For newcomers to riding there are invariably surprises. Elizabeth Heilman, who works for the Ford Foundation, was forced to jump off her horse recently when it decided to lie down and roll in the warm sand. "The horse has never done that before," said Abdul Nabi. "Now we know that she does that."

When the heat of the Egyptian summer settles in riders give up midday rides in favor of early morning or sunset time. Or when the moon is full and the horses can see well there are night-time rides. Children often enjoy dismounting on promising sand hils to hunt for fossils and sea shells.

For seasoned horsement longer rides can be arranged to Saqqare, about 10 miles away, where there is the first pyramid, dating from 2800 B.C. The ride takes about two hours each way and is made through farmland along a canal that parallets the Nile. With some planning a picnic lunch can be arranged, perhaps in an old tomb if the weather is hot or on the warm sand if it is chilly. The faint of heart can go back to town by car, but the purists will make the trip back on their horses.

It costs about $2 an hour to ride at the two stables near the pyramids, Abdul Aziz and Mohamed Ghoneim, known as A.A. and M.G. Americans, Britons, Australians, Scandinavians, Canadians, Germans, Italians and French come in large numbers. There are two more riding clubs on Gezira Island in Cairo but their terrain is limited to the Gezira Club grounds and they are frequented mostly by serious equestrians who are content to ride in a ring or around the adjacent race track.

The trip to the desert and the stables about eight miles from downtown Cairo instensifies the need to escape. It is a cacaphony of honking buses, trucks and cars, of braying donkeys and broadcast calls to prayer. Beggars and matchsellers prey on those stuck at traffic lights and little boys demand baksheesh, a cross between a tip and a bribe, to leave you alone.

The guides and teachers at the stables are all Egyptian men. Like riding instructors everywhere, they are good at giving peremptory commands and making themselves heard. Instead of riding britches, they weargalabeyas, the traditional Arab flowing caftan like garments. Their boss is called the sheikh and he is in charge of the stable, a hundred or more horses, the grooms, the instructors and the riders.

Many of the horses are former race horses that were too slow or occasionally one that was too fast and was disqualified by the race judges as probably having some thorough bred blood. THey are generally well-mannered and carefully groomed and few are over worked or too thin. For good riders there are stunningly beautiful stallions that would grace any American horse show. As one jaded observer of the Cairo scene commented sourty, the horses "are realy the most high-spirited and beautiful things in Egypt."