THE TRANSPORTATION of natural gas was never more than secondary in the negotiations with Canada over the next gigantic pipeline from Alaska. The main question was whether the two governments could agree on a huge project that cuts into national sensibilities in both countries. If the deal had collapsed, it would have been an evil omen for a very long list of common interests, from environmental protection to the trade in automobiles.

But there they were last Thursday morning at the White House: President Carter and Prime Minister Pierre Trudeau, celebrating an agreement. It was a lighthearted occasion, with no suggestion of the pressures that the decision had generated. It represents, remember, upwards of $10 billion in construction and an ensured flow of gas to whatever regions it ultimately serves. The chosen route follows the present oil pipeline from Prudhoe Bay down through Alaska to Fairbanks, then turns along the Alcan Highway across Canada into the upper Midwest.

In the United States, the opposition to that route was fed by a rising wave of protectionism that wanted those construction contracts and jobs to go only to Americans. It also drew on suspicions of a Canadian government that is notoriously soft on native claims, preservation of the northern landscape. The El Paso Corporation vigorously pressed what it called its "All-American" route along the oil line down to the Pacific Ocean, where the gas would have been liquefied and shipped by tanker to California. Never mind that it would cost far more than the land route, and would be more dangerous, and would deliver the gas to one of the few parts of the country that doesn't really need it.

In Canada conversely, there's strong current of economic nationalism that sees nothing but exploitation in the American connection. In that view, what's good for the United States has to be bad for Canada - particularly when the subjects are energy and natural resources. Some of the nationalists saw the Alaskan line as a deception, the real purpose of which was to give the United States access to the gas in Canada's Arctic. Since there's a sharp shortage now of natural gas in this country but not in Canada, some Canadians saw the pipeline negotiations as an opportunity to extract an extortionate price from Americans for the right to cross their terriorty. But the final agreement seems to strike a reasonable balance. Although the pipelines will return very substantial tax revenues to Canada, the agreement recognizes that Canadian consumers as well as Americans will draw benefit from it.

If these negotiations had collapsed, it would have been a triumph for mutual distrust. The unfortunate thing about distrust is that it becomes contagious and spreads rapidly from one issue to another. The pipeline agreement maintains momentum in another and healthier direction. There were moments when a few of the route's opponents were whispering here in Washington that after all, Canadians are foreigners and how can we be sure that they won't turn off the gas? But they won't - for the same reason that they (or, for that matter, Americans) don't interrupt the tens of thousands of gas lines, oil lines, electric-power lines, water courses, rail connections, highways, air routes and so forth that already join the two countries along the boundary. Neither country's prosperity is independent of the other's or ever can be. That is essentially what Mr. Carter were sayingwhen they talked about the pipeline at the White House.