There are two Cairos. And herein lies the dilemma of modern Eygpt. Call the first medieval Cairo. It is the inner city of narrow, crowded lanes, crumbling tenements, and Mameluke palaces. A gigantic wall to one side was built by Saladin to keep out the Crusaders. There are said to be 1,000 mosques and minarets here.
This Cairo centers on Al-Azhar University, the foremost cultural institution in the Muslim world. Nearby is El Hussein Mosque where every Egyptian fellah, or peasant, feels compelled to go and pray as soon as he sets foot in the city. Scholarly imams who interpret the Koran and Sharia law dominate a class structure that hasn't changed much in several centuries.
The fellahin from the villages, who make up about 60 percent of the 43 million Egyptians, feel at home in this Cairo. They share a consciousness of a single cultural universe where people hold the same things sacred.
It has been of extreme importance that the grand sheikh of Al-Azhar, Egypt's leading religious dignitary, has ruled that armed Muslim extremists are not proper Muslims.
The second Cairo, along the Nile, is modern and Westernized. Its new buildings and luxury hotels soar from the river banks. Here, traditional Islamic culture has collapsed, swamped by Westernization. This is the Cairo of the linfitah, or upper middle class: the bankers, import-export merchants, contractors, and entrepreneurs, many of whom have made fortunes in recent years. This educated elite, with its Mercedes sedans and color televisions, frantically pursues Western life styles.
The two Cairos even dress differently. In the first, most men wear the galabia, or long, loose gown of the peasants, and skull caps or turbans; many women wear a black veil over their high-necked, long-sleeved black dresses.
In the first Cairo, most people are poor, the vast majority of them village migrants. Many completely reject urban life, keeping their social activities in the city to coffee houses frequented by fellow villagers. They feel their ''real life'' begins on frequent visits home. Their wives attempt to re-create village life in the city, centered on births, deaths, marriages, circumcisions, and religious festivals.
In 1947, just over one-third of Cairo's 2 million people had been born in villages. By 1981 almost three-fourths of Cairo's 10 million people had village roots. Most are village Egypt's ''have nots.'' The poverty line in 1979 was placed at $500 a year; it is estimated that 21 percent of Cairo's households are below it. Families of six or seven often share a single room.
It is from these people that Egypt's Muslim revival draws its recruits. Their attendance at mosques on Friday noon has grown rapidly the past two years. So have the numbers of followers of various tariqas, or Muslim saints. Sufi, or mystic orders, are much larger than they were.
Like the Iranian Shiites, the Egyptian Sunni Muslim fundamentalists tell these slum dwellers that Islamic culture must be purified and that Westernizing Egyptians, including the military commanders and upper middle class who underpin the government's authority, must be stopped in their tracks. They contend that the Egyptians of the second Cairo are heretics.
Unless the cultural gap between the two Cairos is narrowed, President Hosni Mubarak may not easily win his battle to turn back the tide of Islamic militancy. About 55 percent of the 43 million Egyptians are fellahin who, whether in Cairo or their villages, are deeply imbued with the teachings of medieval Islam. Especially in Upper Egypt, education for many is still merely memorizing the Koran from an old village sheikh whose notion of geography is likely to be that the earth is flat and surrounded by sea and the mountains of Kaf, where the djinn live.
These simple peasants live in a culture that is essentially frightened of the 20th century. Islam is a total and living faith to them, tantamount to natural law. Inside this law, they look out at the world as through through holes in the mud-brick walls of their villages. This world can be blurred and frightening, demon-filled and Allah-awesome.
Religion is reinforced by beliefs in magic, sorcerers, demons, djinns, and the power of Satan for evil and Allah for good. Townspeople tend to be deeply in debt, reluctant to leave home, fearful of the police. They reject city values. But they also have great pride, personal courage, and individualism. And they tend (important now) to be passive and nonviolent.
Islam is woven deep into the fabric of their lives. The rituals - the profession of faith (''There is no God but Allah and Muhammad is His Prophet''), fasting, pilgrimages, and alms-giving - are widely observed. All would declare themselves true believers.
The essential belief is simple: The prophets of Israel were all correct, and Jesus was God's last and greatest prophet before Muhammad. (The six prophets of Islam are Adam, Noah, Abraham, Moses, Jesus, and Muhammad.)
The Muslim quarrel has never been with Jesus of Nazareth but with the Christian Church - Coptic, Roman Catholic, Protestant, Greek, or Russian Orthodox - for capitulating to pagan Greek polytheism and idolatry. From the betrayal of the One True God, or Allah, these villagers believe, Islam retrieved the pure religion of Abraham - and in Islam's survival lies the hope of mankind.
One cannot exaggerate the hold of this faith on Egypt's fellahin. In this sense, they are all Muslim fundamentalists. The difference is that the militants , such as the Muslim Brotherhood (or more important, the newer fundamentalist Islamic societies), assert Islam's relevance to politics and to law. They would create an Islamic state. The more extreme groups, such as Takfir wal Hijra (Repentence and Holy Flight) or Jihad (Holy War), which were involved in Anwar Sadat's assassination, would achieve this through violent means.
To Western eyes, the visions from Iran and Saudi Arabia of bearded men in robes and turbans, of stoned adulteresses, flogged criminals, or thieves who have had limbs amputated as punishment, seem barbarous and atavistic.
In Egypt, Islam is usually not so harsh or dogmatic. For example, most fellahin are uneasy with Koranic injunctions on divorce, which they would make as difficult as possible. (According to the Koran, all a husband has to say is ''I divorce you'' three times and it's accomplished.) Polygamy (a Muslim can take four wives if he can support them) is impossibly expensive except for an unusually rich fellah. Egyptian women tend to react very strongly if their husbands take a second, younger, wife and sometimes pack up and leave.
Amputation for repeated theft is not practiced in Egypt. Even so, theft is very rare.
Yet most fellahin are not prepared to give women full rights - especially the right of equal work and education. Women who break sexual conventions may still be killed by their fathers and brothers. Ironically, it is often the mothers and grandmothers, steeped in Koranic teachings, who demand that the most medieval precepts remain binding.
And all Egyptian fellahin, men and women, tend to take the basic admonitions of the Koran seriously, even literally, and try to obey them. Among these admonitions is the affirmation that Islam is a total way of life; Islam claims authority over every little thing that you do.
In recent years, the Islamic fundamentalists have tried to get these social customs, universal in Muslim villages, adopted in Cairo. For example, they insist that on campuses men and women should not sit next to each other in classrooms and that courses should be scheduled to permit time for noon prayers. Cairo streets, even in the central business district, now are strewn with mats at Friday prayer time to accommodate the swelling numbers of faithful. At the universities, where once girls wore Western dresses, about half of them now appear in the long, drab gowns of village women, their hair tucked beneath scarves.
Egyptian President Hosni Mubarak has said his main priority now will be to seek reconciliation with those who politically opposed Sadat. In fact, on Nov. 25 he made the gesture of releasing 31 politicians and others who had been critical of Sadat. They had been jailed by the late Egyptian President in a crackdown of religious extremists and political opponents in September.
The question is how to separate ''extremist'' Muslims from ''moderate'' Muslims.
It is a problem Anwar Sadat didn't solve. He was at home both in Westernized Cairo and in the villages. In a 1976 interview with this writer, Sadat warned those who sought to Westernize too fast to ''look to our community, our people, and our heritage.'' He understood the stresses on Egypt's Muslims and said, ''Egypt should return to the main principles of our Islamic heritage.''
What Sadat feared did seem to happen to the upper middle class, who pursued Western life styles with surprising vigor. What he did not seem to anticipate was that the vast majority of Egyptians, denied the opportunity to Westernize themselves and perhaps lacking any desire to, would retreat rather fanatically to the certainties of traditional Islamic culture.
But many suspect that after the Iranian revolution, Sadat well understood what was happening. In the past year or so, he had begun to stress his first name. He was ''Muhammad Anwar Sadat.'' And the allusions to Islamic values grew in his speeches.
The dilemma now is whether growth that is fast enough to relieve the poverty of Egypt's rapidly rising population is so fast that it causes unbearable strains on Islam.