President Mohammed Zia ul-Haq is riding a crest these days and clearly relishes being courted as the head of the latest bastion against Soviet expansion.

Zia appears cocky, knowing the Soviet invasion of neighboring Afghanistan has strengthened the tenuous hold of his Army-run martial-law government over this country, giving him added clout in his demands for military and economic aid from the West.

Yet interviews during the past week in four major cities show that dissatisfaction with the government runs deep. He is perceived by many diplomats and Pakistanis alike as a military despot who continues to hold power only by repressing political opposition and who faces future unrest because of economic problims and the desire of minority groups for more autonomy.

"America shouldn't support this man," a Pakistani businessman in this politically active city told a visiting American. "You do it every time. You got in bed with the shah and now you are going to do the same with this guy."

Pakistan received aid from the shah of Iran before he was ousted and now is trying to get on good terms with Ayatollay Ruhollah Khomeini, who appears to have great support among the highly religious Islamic masses here.

Zia angrily denies that he is in danger of being toppled the way the shah was. He told correspondents that a vast majority of the 75 million people would support his military government if he held a referendum today. But he also said he will put off for several years the plan to hold elections -- postponed twice already since he seized power in a coup 2 1/2 years ago.

Zia looks more confortable as president now than when he took office. He and many of his follow Army officers no longer talk of turning the country over to civilian control.

Zia called elections "luxuries" that Pakistan connot affort at this time and insisted the military will play "a fundamental role" in administering the country even after martial law ends.

"Forget about your Western ideals and Western standards of freedom and democracy," he lectured American correspondents last week. "You are in a Moslem developing country. And Islam says if somebody says anything against your integrity, against your religion, against your everything, chop him -- teach him a lesson."

Western and Pakistani observers have reported simmering political opposition to Zia's rule.

"There's an increasing amount of clandestine meetings of the political opposition," said one Western diplomat. Another noted that members of the executed former prime minister Zulfiqar Ali Bhutto's Pakistan People's Party -- banned along with all other political parties -- have organized into small cells for "social get-togethers" where politics is the main topic.

Despite the execution of Bhutto last April and the continuing house arrest of the party leaders, including Bhutto's widow and daughter, the party appears to have substantial support in the country.

In elections last September to weak local advisory bodies, members of the People's Party won a vast majority of the seats in the nominally nonpartisan election.

They ran under the slogan, "friends of the people." The word spread by word of mouth through the countryside that these were the party's candidates.

Most diplomats believe the party's strong showing caused Zia to cancel elections and ban all political activity in October. Although most of the party leaders were jailed or put under house arrest then, the Bhutto name still has power.

A city councilman in Hyderabad was arrested a month ago after calling for five minutes of silence at a meeting to mark Bhutto's execution.

Crowds gathered outside the courthouse in Karachi last week when word spread that Bhutto's widow and daughter were appearing there to protest an extension of their house arrest beyond the constitutional limit of three months. they have not been charged.

The crowds were so large that serval truckloads of police appeared, including 15 armed men who stood on the roof of the Sind high court.

"They were obviously worried that this could provide a spark," said an observer in Karachi.

Perhaps the strongest indication of the fragility of the Zia government was its refusal to send troops quickly to stop a mob from burning the U.S. Embassy in Islamabad in November for fear that strong action would start a revolt against the government.

There are strains between the Army and the students that could easily become inflamed, according to diplomats in Islamabad.

But potentially more troublesome is the feeling in the border provinces of Baluchistan and Northwest Frontier that they are not getting their share of the country's meager resources.

By Zia's admission, both regions are underdeveloped,and he has said he will pour much of future economic aid into those provinces.But that may not be enough.

"The tribes in those areas want some more autonomy instead of being under the control of the country's Punjabi majority," said a diplomat. "It's madness not to give it to them. Look what's happening in Iran,"" where national minorities are battling the central government.

The Baluchis tied down a good part of Pakistan's Army in a full-scale rebellion from 1973 to 1977, and while the province appears quiet, there are reports of underlying discontent.

It is Pakistani Baluchistan that would give the Soviets now occupying Afghanistan the long-sought access to a warm-water port, and many observers here look for Moscow to sponsor a Baluchi government in exile to forment trouble in Pakistan.

"Baluchistan," said a resident here, "that's where the trouble is going to be."

Pakistan was created 32 years ago as a haven for Moslems who feared they would be swallowed up in an independent, largely Hindu India. Sensitive about its unity, the Pakistani government nevertheless has been dominated by its Punjabi majority -- which leads to regional discontent that culminated in the 1971 breakaway of East Pakistan to become Bangladesh. t

Zia concluded his speech last week to frontier tribal leaders in Peshawar with a cry for "internal unity and national cohesion" based on Islam.

Islam is the major unifying force in this country. Yet is also symoblizes the fundamental split between the devoutly religious masses and the thin layer of Western-educated businessmen and politicians who run the country.

Even Muhammad Ali Jinnah, who led the fight for Pakistan as an Islamic state, was not a devout Moslem. He was apparently more interested in creating a political power base for himself than in fostering Islam.