Two days of bilateral discussions here have left U.S. officials less optimistic than ever about heading off Pakistan's drive for an atomic weapons capability.

The talks between Secretary of State Cyrus R. Vance and Pakistani foreign affairs adviser Agha Shahi, as well as recent intelligence reports, have also left U.S. officials less certain than before that a Pakistani nuclear explosion is at least two years away.

A Pakistani atomic test would be a grave setback for efforts by the United States, Soviet Union and other technologically advanced countries to curb the spread of nuclear weapons. Such an explosion would be certain to spur Pakistan's neighbor and rival, India, to undertake new atomic Weapons development projects and could encourage other Third World Countries to seek atomic arms, according to officials.

Shahi, who is his country's senior diplomat, reportedly told members of Congress following the meetings here that President Mohammed Zia ul-Haq would be willing to give the United States a "no explosion" pledge during the life of his current government.

According to Rep. Lester Wolff (D-N.Y.), chairman of the House Foreign Affairs Committee's subcommittee on Asian and Pacific Affairs, Shahi also made it clear, however, that Zia could not tie the hands of a future Pakistani government. Shahi told the U.S. lawmakers that Secretary Vance and other high American officials have been seeking a longterm commitment that there will be no explosion.

After a lengthy Capitol Hill meeting with Shahi, Wolff also quoted him as saying that Pakistan is willing to place all its nuclear facilities under international safeguards and inspections, but only if India does the same. So far India has refused and shows no current sign of changing its mind.

Rep. Jonathan Bingham (D-N.Y.), who also met with Shahi, said that "a very serious situation is developing . . . due to the apparent determination of Pakistan to develop a nuclear weapons capability." Bingham called for intensive U.S. diplomatic effortrs to seek a regional arrangement of nuclear weapons restraint involving both Pakistan and India.

Although the U.S.-Pakistani talks at the State Department were described by participants as more candid than ever before, Shahi apparently cast little light on whatever secret planning exists in Islamabad about the highly enriched uranium plant being built nearby.

The Pakistanis suggested, according to one account, that no decision on an atomic test was likely for at least six months to a year. Previously, most U.S. officials had been confident that a Pakistani explosion is at least two to five years away.

A recent U.S. intelligence report quoted a Pakistani who is privy to inside information as saying that "we have the material" to make a bomb. Even though some U.S. officials speculate that the statement may have been made for political effect, it has generated concern in official circles.

The United States is seeking "reliabile assurances" that Pakistan will not produce or acquire nuclear weapons or aid any other country in doing so.

Under a U.S. nonproliferation law, such assurances must be obtained before Washington can resume economic or military aid, which was cut off last April after confirmation of reports of the clandestinely assembled Pakistani plant to make weapons-grade uranium.