Pakistan's rejection of a $400 million U.S. aid package earlier this month appeared to result more from a series of American miscues and missed opportunities than any Pakistan resolve not to accept the offer, according to diplomatic sources here.

The two countries' failure to agree on an aid package not only marked another in a string of U.S. foreign policy setbacks, but it apparently also caused some strains in Pakistan's military government.

Some Army officers reportedly were anxious for aid to build up the poorly equipped Pakistan armed forces and became upset with President Mohammed Zia ul-Haq for spurning the U.S. offer as too little.

The breakdown of the proposed aid deal leaves Pakistan with few options in trying to bolster its defenses following the Soviet Union's invasion in December of neighboring Afghanistan.

There has been no sign of any new aid from the Persian Gulf Oil states that also are concerned about the invasion. But both Pakistan officials and diplomats said yesterday that talks with Saudi Arabia on aid to buy military hardware are going well.

According to officials here, the major miscuses in the U.S. aid offer occurred when President Carter's national security adviser, Zbigniew Brzezinski, flew here nearly six weeks ago, publicly proclaiming that Pakistan was on track as a keystone of the Carter doctrine for the defense of the Middle East and South Asia.

It was no secret here or in Washington that Pakistan thought the offer of $400 million over two years, equally divided between economic assistance and 11 percent loans to buy military hardware, was too low to meet its needs.

It now appears that Zia misunderstood the purpose of the Brzezinski mission here and believed -- despite U.S. denials -- that such an important figure in the Carter administration would only visit Pakistan if he were going to offer more money.

Some diplomats here speculated that Zia believed the U.S. denials were part of a bargaining ploy and waited in vain from the day Brzezinski left for a new offer. In any case according to knowledgeable diplomats here, on orders from Washington there was no follow-up visit by U.S. Ambassador Arthur W. Hummel Jr. to the Foreign Ministry to clear up any possible misunderstandings.

Sources on the Brzezinski plane took as a good sign the fact that Pakistan did not want the Carter adminstration to put the $400 million aid package to Congress immediately after the trip.

They saw it as meaning that Carter's State of the Union pledge to guarantee Pakistan's security had bolstered Zia more than even money would. In fact, it now appears they miscalculated just how strongly Zia believed $200 million in U.S. military aid would cause Pakistan more grief than it would contribute to its security.

Pakistani officials felt that amount of aid would buy few of the weapons the military needs. But $200 million would be enough to alienate the Soviets, now perched on Pakistan's western border with Afghanistan; anger the Indians, with whom Pakistan has fought three wars in the past 32 years; upset its newly formed relationship with the nonaligned movement and make it appear a stooge of the United States to other Islamic countries, especially Iran.

But officials on the Brzezinski mission saw it different.

"We just saved the U.S. Treasury $400 million," one joked after the final talks with Zia produced the agreement not to go to Congress immediately with the aid package.

While the possible Pakistani rejection of the aid package was expected here, the way it was done -- in a public speech 10 days ago with no advance notice -- stunned American diplomats. They were not even sure what the rejection meant until Ambassador Hummel paid a formal call last Tuesday, six days after the speech by Zia's foreign policy adviser Agha Shahi -- on Foreign Secretary S. Shah Nawaz.

It was then that the U.S. diplomat learned that the Agha Shahi speech was not a total rejection of the package but rather of the military portion of it and the linkage of the aid with a congressional endorsement of the 1959 security agreement between the two countries.

Pakistan, it turned out, still wanted the economic aid and was most anxious to get the congressional reaffirmation of the security treaty. Zia had, in fact, backed down from an earlier demand to have the executive agreement converted into a binding treaty.

The question of linkage appeared to be a major misunderstanding between the American and Pakistanis after the Zia-Brzezinski talks.

Pakistani sources insisted yesterday that they had been told the entire package had to be submitted to Congress in a bundle. Sources in the Brzezinski delegation, however, left the strong impression in talks with reporters that the component parts could be separated.

Thus the public rejection of the U.S. aid package by the Pakistanis created an image among diplomats here of the United States as a country not in control of its own foreign policy.

It also raised anew among both Western and Asian diplomats here the question of Carter's reliance as a bulwark against Soviet expansion on the slim reed of Zia's martial-law government, which three months ago failed to respond for five hours to rescue more than 100 persons trapped by an attacking mob in the blazing U.S. Embassy here.

Pakistan had been a major U.S. aid recipient until last April and a key ally against the Soviets during the 1950s.

For the last year, however, there has been a ban on new aid to Pakistan because of its nuclear program, which the United States insists is aimed at creating atomic weapons through clandestinely acquired technology. Pakistan denies this.

To give any new aid to Pakistan, the Carter adminstration would need a special congressional act to override laws aimed at curbing the proliferation of nuclear weapons.

Pakistan insisted during the Brzezinski talks that its nuclear program was peaceful, but it refused to rule out any explosions, and recent U.S. intelligence data showed that work continues on a plant to produce weapons-grade enriched uranium.

According to diplomats, no amount of aid would persuade Pakistan to drop its nuclear program. Nonetheless, there is little doubt here that Zia would accept U.S. military aid if the offer was high enough. Pakistan officials have said they need "several billion dollars" in military aid to build up defense on the western border with Afghanistan.

High Pakistani officials acknowledged to non-American diplomats here that they would have accepted a U.S. aid package that totaled $1 billion or more.

"Zia can be bought," said one diplomat, "but not for $400 million."

As an example of the problems the U.S. aid offer has caused already, one highly placed Pakistani diplomat cited the warning by Soviet Foreign Minister Andrei Gromyko in New Delhi last month that Islamabad "will get nothing good and undermine its position as an independent state" if it takes arms from the United States.

"The U.S. responses were not commensurate with Pakistan's needs," continued the diplomat. "Nonetheless, Pakistan has been made to pay the price in international propaganda against it."

In his rejection of the U.S. military aid offer, Agha Shaihi extended an olive branch to the Soviet Union, asking for better relations once Moscow withdraws its troops from Afghanistan. Diplomats here doubted that this signaled a Pakistani attempt to move into the Soviet camp, in the way North Yemen abandoned a Carter administration embrace to resume being a major Soviet arms client.

Even though Zia talked about keeping his options open regarding the Soviet Union, most analysts here believe the Moscow card is not feasible for Pakistan. For one thing, the two bordering states which most threaten it -- Afghanistan and India -- already are locked up by friendship treaties with the Soviets.Moreover, stronger ties to the Soviets would threaten Pakistan's relation with China and its closeness with other Islamic countries, notably Saudi Arabia.

Aid from the Saudis and other Islamic states would preserve Pakistan's status as in the nonaligned movement as well as free it from charges of becoming an American puppet. Such aid would no be likely, however, to ease Indian fears of end Soviet charges that Pakistan is part of a U.S.-Chinese cabal threatening Afghanistan.