Pakistan's pursuit of a nuclear bomb is posing the United States the sternest test ever of its policy against proliferation of nuclear weapons, and right now it looks as though the United States is going to fail. Pakistan is acting every inch the country whose former leader said it would ''eat grass'' to match India's bomb.

Pakistan's nuclear march is deplorable, the more so for being done by a friendly state under heavy carrot-and-stick inducement from Washington to slow down. But there is a quality of grim inevitability to it too. Americans prefer a world in which as few others as possible have a capacity for a nuclear initiative. From a Pakistani point of view, however, it becomes increasingly difficult to see how things could be otherwise.

Pakistan is a vulnerable, insecure country that lives in fear of being overwhelmed by its powerful, hostile, nuclear-capable neighbor, India. Four security options are open to it. One option is to improve relations with India, which India by temperament and, I suspect, by policy does not make easy. The second is to kneel to India, which Pakistan rejects. The third is to seek shelter under the umbrella of the United States, which Pakistan has long done. The fourth is to go nuclear, which, as we see, greatly complicates option three.

When India exploded its bomb in 1974, Pakistan pressed options three and four simultaneously. Jimmy Carter retaliated by suspending aid -- tantamount to folding the American umbrella -- but work on a nuclear option continued. Ronald Reagan, to get aid to Afghanistan going, reopened the American umbrella. Now Reagan may be forced to fold the umbrella again, but Pakistan will surely keep its nuclear program going.

I wonder if anything could stop Pakistan from taking out nuclear insurance. Its quest could be delayed or made more difficult or costly but not halted. Accommodation with India, the best alternative, seems distant. America could never provide remote, relatively insignificant, military-ruled, Moslem Pakistan with a guarantee of patronage ample and reliable enough to deter a nuclear program of its own.

If the United States now cuts off aid, Pakistanis will be confirmed in their conviction that they were right to start down the path to nuclear independence. A cutoff will remove what ability Washington has had to get the Pakistanis to conduct their program more discreetly. Further, as Pakistanis are increasingly given to remind us, an aid cut cannot fail to lead them to recalculate the risks they wish to take in supporting the resistance in Afghanistan.

One can grant the grim truth of these considerations and yet find it entirely unacceptable to sit here and be lied to by the Pakistanis about their nuclear program. That we have also been lied to by Indians and Israelis does not make it more acceptable.

The way the nonproliferation law is written, the United States is not compelled to penalize India and Israel for programs more ambitious and advanced than Pakistan's. In that sense the law is unfair, but the law was not written to be fair: it was written to provide special dispensation to Israel and India and to lock the barn door against the theft of a third horse. More broadly, it was written to buy time to head off a nuclear notching up in South Asia. But the effort is failing. The Indians remain imperious and patronizing and the Pakistanis scared and prickly. A few months ago their armies came perilously near a fourth war.

A sense of the unfairness of punishing only one country, and not the ''guiltiest,'' inclines some Americans to want to spare Pakistan the full brunt of the law. Saving the Afghan resistance comes in here. But to wink further at the law would be a mockery. It would be more honest to repeal the law.

Whatever, it is a sad time for the disparate controls and inducements that constitute American nonproliferation policy. Many people have pet proposals for repairing the damage, but there is no energy behind any of these familiar ideas.

The ''solution'' commended by some Pakistanis -- and some Indians and Israelis -- is to confer legitimacy on their own nuclear plans and/or arsenals: to start institutionalizing nuclear deterrence regionally the way the superpowers do it globally. It strikes me as a terrible idea, but maybe this is where things are going.