THE DIPLOMATS of the Western alliance are grinding doggedly along in search of a way out of the pipeline maze. The meetings continue at the State Department, accompanied by cautious murmurs of progress. It has been more than two months since the United States began imposing sanctions on the European companies that were shipping equipment built under American license for the Siberian gas pipeline. It is hard to think of any decision in the last decade that has proved as deeply divisive. Is there any light at the end of the pipeline? Maybe.

There are some useful lessons for Americans in this collision. One is that it's unwise to try to do as Mr. Reagan has done, to reach through international corporate relationships into other countries' business. Those other countries see it as a direct attack on their sovereignty, and tempers rise fast. This tactic leaves a deeply damaging residue of suspicion. It strengthens all the nationalists and protectionists throughout Europe and Asia, no great friends of this country, by enabling them to argue with plausibility that it's dangerous to let the Americans in. Their government will use them, the argument goes, to enforce its foreign policy.

Another lesson is that an embargo can only be built on a political consensus. You will sometimes hear it said that trade embargoes never work. That's not really true. The Western embargo of strategic goods to the Soviet bloc has worked fairly well in the past, and there's probably a pretty firm base of agreement to strengthen it. But the United States can't take a unilateral stand and then start whacking its friends for failing to cooperate.

The solution now coming dimly into sight is a new set of rules for trading with the Soviets. It expands, and enforces more rigorously, the list of forbidden exports -- those that have specifically military and strategic uses. But it does not try to use other kinds of trade as political levers for vaguely defined purposes. Perhaps it tries to set some sort of limits on Western governments' subsidies of trade with the East. But it doesn't try to push that point very hard, recognizing that it quickly gets into the basic differences between Mr. Reagan's idea of good economic policy and, say, a French Socialist's. And with that, as quickly as ingenuity permits, it declares an end to the great pipeline crisis and the American sanctions on the Europeans. Speed is important. The political benefits of these sanctions are all going to the Soviet government, the people whom they were supposed to punish.