Pakistan's first national election in seven years has moved the country closer to a restoration of democracy but also has posed for President Mohammed Zia ul-Haq formidable risks when he fulfills his pledge to lift martial law, U.S. Ambassador Deane R. Hinton said today.

Hinton, in an interview following Zia's victory yesterday over an opposition boycott of the parliamentary elections he called, said that if martial law is lifted, it would be a "big plus" in making Pakistan more palatable to congressional and other U.S. critics of massive aid to what the United States sees as the frontline bulwark against Soviet expansionism in the region.

But, he cautioned, Pakistan's history of political instability, coupled with an inexperienced parliament and a gradually deteriorating economic situation, could strain a new civilian administration to the breaking point.

Hinton's comments came as a boycott of the National Assembly election called by the 11-party opposition coalition, the Movement for the Restoration of Democracy, collapsed under a surprisingly high voter turnout by Pakistanis who had not been able to vote during more than seven years of martial law rule after Zia overthrew the popularly elected government of Zulfiqar Ali Bhutto in July 1977.

The government today put the official turnout at 52 percent, with 203 of 207 districts reporting. Many opposition leaders did not challenge that figure, which is comparable to turnouts in previous national elections. Instead, they claimed victory in the defeat of five of nine National Assembly candidates who were in Zia's 17-member Cabinet and ardent supporters of Zia.

Cabinet members defeated included Defense Minister Ali Ahmed Talpur, Labor Minister Ghulam Dastagir Khan, Culture Minister Arbab Niaz Mohammed, Information Minister Raja Zafarul Haq and Power Minister Raja Sikandar Zaman.

Zia dissolved his Cabinet today, but asked eight ministers who had not run in the election to remain in office until a new one is formed, The Associated Press reported.

"You shouldn't judge Pakistan by the standards of Jeffersonian democracy or Westminster democracy. It is a country that for 37 1/2 years hasn't worked very well," Hinton said.

He said that the question is whether in Pakistan, "a country with little political experience, a reputation for volatility and for taking to the streets with violence and with a population overwhelmingly illiterate, will democracy work in such circumstances? We think it can. But if you're asking me if we are unaware that there are risks, no, we are aware of risk. But there is no way you can predict what will happen."

Hinton's comments underlined the sensitive nature of a U.S. foreign policy that seeks to support strategically important nations that are considered by many to be dictatorships but that the Reagan administration would like to edge toward a semblance of western-style democracy without going through political chaos.

While the Movement for Restoration of Democracy also took solace in the defeat of about half of the candidates who are members of Zia's largely powerless consultative assembly, the Majlis Shoora, and a poor showing by the pro-Zia fundamentalist Islamic Party, the Jamiat-e-Islami, the surprisingly high voter turnout appeared to represent a net gain for the president and a debilitating blow to the fractious opposition alliance.

The question on the minds of Pakistani political analysts and opposition activists today was when Zia will lift martial law as he has promised and institute what he terms the "new political order."

Hinton, who has represented the U.S. policy of nudging Pakistan gently toward restoring democratic institutions suspended by Zia, including the 1973 constitution and much of the civilian judicial system, said, "I think he is going to watch this new animal and see how it functions" before beginning to lift martial law.

"Things are going to be different around here with an elected parlimament," Hinton said. "Anytime you elect people, those people seek power. The question is, can he maintain equilibrium or balance, or will it get out of control again as it has in the past?"

He added that Zia "has broken through. But he and a new prime minister and a new Cabinet and new assembly have got to make the system work. God knows what another failure would lead to."

Complicating the transition, Hinton said, is the economic situation in Pakistan. Its 10 percent growth rate has equaled that of any developing country but it now faces a serious budget crisis and balance-of-payments problems after a poor cotton season and dwindling foreign remittances.

"What if there is economic heavy weather ahead? How does an elected parliament with no experience deal with these issues?" the ambassador asked.

Another concern, he said, is what will happen if the National Assembly and the provincial assemblies to be elected Thursday -- on a partyless basis, as was the National Assembly -- begin vigorously debating divisive national issues such as Pakistan's support of more than 2 million Afghan refugees on its western border.

"The American political doctrine is that it is good to talk and get the issues out. This should work to pull society together, ideally. . . . But it might work the other way," Hinton said.

There were signs in various parts of Pakistan today that the crumbling of the opposition parties' boycott signaled a resurgence of active electoral participation in Thursday's elections, in which more than 4,600 candidates are competing for 460 seats in the four provincial assemblies.

Brisk campaign activity was reported even in the traditionally alienated provinces of Sind and Baluchistan, and candidates in the populous Punjab Province began rallying voters in what they said they hoped would be an even larger turnout than yesterday's.

In Muree, a hill town north of Islamabad, hundreds of campaign workers spilled out of headquarters buildings and indoor rallies and into the streets in an atmosphere of enthusiasm that was noticeably lacking in the National Assembly campaign.