Conceived as a monument to President Habib Bourguiba's vision of Tunisia as a modern, westernized state, the University of Tunis campus has instead become a stronghold of Islamic fundamentalism.

A sharp shift in political allegiance on the campus over the past few years has provided a dramatic illustration of the kind of problems Tunisia could face after the death of its founding father. Disillusioned with the western-style values embraced by Bourguiba, students at the university have been turning for political inspiration to Islamic groups that are illegal here.

Better fed, better educated and more widely traveled than their parents, the 40,000 students at the University of Tunis are in many ways the children of a social revolution unleashed by Bourguiba, who led Tunisia to independence from France in 1955. The fascination of many of them with ideas rejected by Bourguiba is a reminder that history can often play tricks on those who try to mold it.

"Bourguiba tried to break with 14 centuries of history and relegate Islam to the mosques. For us, Islam is not just a religion but a way of life. You cannot separate Tunisia from its Islamic traditions," said Ezzedine, a second-year law student encountered at random on the university campus.

The resurgence in fundamentalist ideas in Tunisia is regarded by many Tunisian and foreign analysts as a delayed reaction against the hectic pace of modernization conducted by Bourguiba. Soon after he came to power, the president replaced Islamic law with a western-style legal code that included protection of women's rights and absorbed one of the Arab world's oldest Moslem universities into the state system.

The largest of the fundamentalist groups, the Islamic Tendency Movement, claims to draw support from all over Tunisia. As an illegal political party, however, it is not allowed to hold public meetings and its activists are closely watched by the police.

Questioned in a recent interview about the rise of Islamic fundamentalism, Bourguiba said Tunisia was a Moslem country and welcomed any Islamic group that worked for the country's progress and development. He added, however, that Islam should be purged of "any fanaticism which is the product of centuries of ignorance and obscurantism."

"To make a political program out of Islam and exploit religious feelings, to found a political party on this program, is something I will not admit," he said.

The growing support for the fundamentalists at the university has come largely at the expense of the extreme left, which dominated the campus for much of the 1970s. Bourguiba's ruling Destourian Socialist Party controlled university politics in the 1960s but now has difficulty mobilizing significant support.

"The university used to be Bourguiba's fortress. Today it is our fortress," claimed Abdelfattah Mourou, one of about 100 leaders of the Islamic Tendency Movement who served prison sentences between 1981 and 1984.

With university politics polarized between left and fundamentalists, there have been violent clashes over such issues as whether cafeterias should be open during Ramadan. The fundamentalists argue that all Moslems are obliged to fast during the holy month while the leftists say people should be free to decide whether to fast.

Staff and students at the university drew a distinction between Tunisia's Islamic fundamentalism and Iran's. While Tunisian fundamentalists drew moral encouragement from the 1979 Iranian revolution, they depict themselves as more moderate than Ayatollah Ruhollah Khomeini, with different spiritual and historical traditions.

As native Arab speakers and members of the Sunni branch of Islam, Tunisian Moslems have not developed a special caste of religious leaders to interpret the Koran for them.

Baki Hermassy, a sociologist at the university, linked the emergence of Islamic fundamentalism here to an ideological gap left by the declining appeal of nationalism, socialism and pan-Arabism.

"People were promised too much and the system hasn't been able to deliver," he said. "The fundamentalists have been successful in presenting themselves as defenders of the have-nots."

By contrast with several other Arab countries, the fundamentalist movement in Tunisia has its roots in the cities rather than in the country. The Islamic Tendency Movement traces its origins to the late 1960s when students came to hear Mourou and other fundamentalists preach in the mosques.

Officials of the ruling Destourian party have sought to minimize the significance of the fundamentalist movement by calling it a transitory political fad. They say their party is beginning to rebuild a student base and they insist the appeal of the fundamentalists has peaked.

"When students leave the university and get a job, they change their ideas," said Mohammed Sayah, a government minister mentioned as a possible successor to Bourguiba.

Sayah's optimistic view that former students grow out of their "fundamentalism" was disputed by a professor who suggested that up to 70 percent of fundamentalist activists at the university remained politically committed in later life.

Although fundamentalist students angrily reject the suggestion that they are the "children of Bourguiba," some of their attitudes betray signs of his influence. The wearing of the chador or veil is not considered a necessity by most women fundamentalist students on the American-style campus.

Many students, including women, expressed support for elements of Bourguiba's personal code passed in 1956 that outlawed polygamy and a man's Koranic right to divorce his wife by simply repudiating her.

In provincial Tunisian towns, where political controls tend to be much stricter than at the university, the fundamentalists have experienced greater difficulty in amassing support but it is difficult to estimate their strength.

In Qairouan, site of Tunisia's holiest Moslem shrine, fundamentalists said they intend to use a theological dispute over precise dates of Ramadan to win support for their cause. The government's calculation of the beginning of the holy month by reference to an astronomical calendar has upset Moslem traditionalists who have timed their fast to coincide with the first sighting of the new moon.

"There is a difference between the official beginning of Ramadan and our visual sighting every year," said Abdelwahab Keffi, a schoolteacher and Islamic Tendency Movement leader. This year teams organized by Keffi sighted the new moon a day before the official beginning of Ramadan and began fasting.

Keffi said he planned to defy the government by declaring the end of Ramadan in the local mosque a day before the fast is officially over.