THE SUDDEN LEAP in gasoline and heating oil prices in recent weeks has taken the country by surprise. Is it all the result of Mr. Reagan's decision at the end of January to end the remaining controls on the prices of oil and gasoline? Decontrol is part of the explanation but, it turns out, only a minor part.

Every few weeks throughout last year, one foreign oil producer or another has raised prices. Here in the United States, the Carter administration was gradually peeling off price controls. From early spring into late autumn, this increase was mostly absorbed by the refineries. They had trouble passing it on to the retail price during the summer, because they had plenty of gasoline to sell and competition at the pumps was fierce. Divers had cut back consumption dramatically, already resisting prices that they considered extremely high. But the atmosphere changed at the end of September, with the war between Iraq and Iran. That cut off two important sources of supply and, in November, wholesale prices began moving slowly up. At the turn of the year there was another spate of foreign price increases, some of them retroactive.

From last autumn to the present, the price of crude oil to the American refineries seems to have gone up 15 centgs to 20 cents a gallon, the precise amount varying from one company to another. All of the refiners wanted urgently to pass it on to the customer and reestablish their profit margins. They were able to do it most rapidly in heating oil. As usual, retail prices went shooting up with the arrival of unusually cold weather. In the case of gasoline, both wholesalers and retailers have been much more cautious, and have been feeding the increases through more gradually. It's the slack season for driving, and it's always much easier for the customer to switch brands of gasoline than heating oil.

There seems to be a consensus that the present price of fuel oil now fully reflects the recent increases in crude oil costs. But that's not true of gasoline. There's probably another 5 cents to 8 cents a gallon to come at the service stations, merely to pass on all of present cost of crude oil.

As for the coming spring, oil prices will depend on all of the usual things -- the war, the Saudis, the American motorist. The war seems to have settled into a tacit truce in which neither the Iranians nor the Iraqis are going after the other's oil facilities. Exports from both countries are rising, and the world oil market is beginning to worry again about the possiblity of a slight oversupply.Saudi Arabia apparently intends, at least for the present, to continue producing at its present high level. American consumption of gasoline and fuel oil continues to drop, although the drop is no longer as rapid as it was last year.

But even if the supply of oil for the near future continues to be adequate, gasoline prices are likely to keep rising -- just as the price of foreign crude oil is going to keep rising. Is there no limit to the process? There's a hint of an answer in the refiners' inability to raise their gasoline prices last summer. By buying less, motorists make it more difficult and risky for the sellers to keep pushing up their prices. As a counterstrategy for consumers, that's not always easy or convenient. But, unlike all the others, it works.