A breakdown in the system for shipping Canada's huge grain harvest from the prairies to the ports has emerged as one of the most serious problems facing the new government of Prime Minister Joe Clark.

An estimated $1 billion in grain exports has been lost in the last two years because of delays and bottle-necks in rail transportation.

Contracts covering a staggering 8.4 million tons of grain -- mainly wheat and barley -- have been canceled or deferred because of shipping problems, according to the Canadian Wheat Board.

Last week, some of the 20 grain ships at the western port of Vancouver had been waiting as long as 18 days for wheat to arrive from the interior at harbor rail depots.

Some economists say the situation has a direct bearing on grain and food prices in the United States. This is because foreign customers look to the United States to supply grain that is unavailable in Canada and this adds to upward pressure on U.S. grain prices.

As foreign buyers switch to American grain, there are additional stresses on U.S. railroad and barge companies, which are strained to the limit this fall by surging grain exports.

Canada is the world's largest grain exporter, after the United States, so its agricultural transportation difficulties can affect food supplies in dozens of countries. Some predict that future increases in North American grain exports will have to come mainly from Canada, because U.S. growth is limited by a decline in underground water for irrigation and by the potential dangers of soil erosion in marginal grain growing regions of the West. But Canada's transportation problems are a major obstacle to that country's ability to supply more food to the world.

The former government of Prime Minister Pierre Trudeau commissioned several massive studies, made changes in the grain marketing system and allocated federal funds to refurbish aging boxcars.

However, the new government that took office June 4 has raised fresh hopes in the prairie farm provinces that agriculture's needs will receive an even higher priority.

The Conservative government led by Clark of Alberta is dominated by western politicians whose power base includes the country's grain producing provinces of Alberta, Saskatchewan and Manitoba. Many of these westeners are steeped in prairie farm politics whose tone continues to be set by descendants of East European emigres.

The Clark government has pledged to increase grain exports by 50 percent by 1985.

Clark's transportation minister is Donald Mazankowski, another Albertan.His portfolio includes responsibility for the Canadian Wheat Board, the agency in Winnipeg that markets prairie grain and supervises its movement to the ports. Mazankowski, a former car salesman, was in Poland last week trying to sell Canadian grain.

The new government also has named a third Albertan to a new post of "czar" for grain transportation, with broad powers to streamline the system.

"The challenge is to show the producers that we can bloody well move grain," said the appointee, Hugh Horner, Alberta's former minister of economic development.

Officials in Ottawa acknowledged that meeting the challenge will require large amounts of money and political skill.

A study released this summer by consultants Booz-Allen & Hamilton said that a total of 9,300 new grain hopper cars costing $400 million would be needed by 1985. The rail-car shortage has meant that the Canadian Pacific and Canadian National railroads, the main grain haulers, frequently have no cars available for moving commodities from the interior to ports where ships are waiting for them.

The average age of the cars of the Canadian Pacific is 29 years, compared with 33 years for the Canadian National. The Canadian National recently announced it would acquire 1,000 new cars suitable for grain, but the Canadian Pacific has refused to make any such commitment.

The railroads also maintain that thousands of miles of rural lines are expensive to maintain and unnecessary -- a complaint that echoes those made by U.S. railroad companies.

A "prairie rail action committee," and outside consultants have recommended abandoning a total of 3,450 miles of track. To date, the Canadian Transportation Commission has approved dropping 1,401 miles and is reviewing the rest.

An even more serious problem is railroad rates, which the railroad companies claim give grain a "free ride" and discourage investment in new equipment for hauling more grain.

The rates for grain moving to the export depots were first fixed in 1897. The present rate was set by statute in 1925. The rate for shipping a bushel of wheat from Winnipeg to Thunder Bay on the western end of Lake Superior is around 16 cents, a fraction of the U.S. fee. The difference between this amount and the actual cost is supposed to be made up by a federal subsidy and grain farmers. But the railroads say they still lose money and their claim has been supported by at least one private study.

The government's problem is that changing rail rates and abandoning rail service to small rural communities rank among the most politically volatile issues in the prairie provinces. Anger at railroad monopolies helped spawn prairie socialism in Canada in the last century, and the currents of that movement still are alive in the west.

Any sign that the government is helping the railroads without tangible benefits to the farmers would be damaging to the minority Clark government, which controls only 136 of the 252 seats in the House of Commons.

"Cursing the railroads is a religion in the West," said a senior government aide in Ottawa. "We will have to move slowly."

Nevertheless, some officials maintain privately that the grain provinces can be persuaded to accept rate changes in return for a streamlined transportation system that would enable farmers to ship more grain.

For now, the Clark government is postponing decisions on rates in favor of less controversial steps.

Plans are moving ahead for a huge new grain port at Prince Rupert, 500 miles north of Vancouver at the Alaskan border, to be built by a consortium that includes four Canadian cooperatives, a private Canadian grain company and Cargill of Minneapolis.