In the trade skirmish between the United States and Canada, Prime Minister Brian Mulroney aimed some bullets south of the border last week to retaliate for those fired north by President Reagan in late March.

But the people in the fledgling Canadian book publishing and electronics industries said what the prime minister actually did was shoot them in the foot when he imposed tariffs on American imports.

Far from injuring American corporations, the Canadian manufacturers and publishers said, the retaliatory tariffs on books, computer parts and semiconductors most likely will raise costs to Canadian consumers and cut into the companies' profits.

President Reagan started the fighting by announcing a 35 percent tariff on Canadian red cedar roofing and siding materials which took effect Friday.

But like Mulroney, Reagan may have hurt rather than helped the alleged victims.

Instead of reviving suffering U.S. cedar shake and shingle producers, the new import duty may merely drive up prices and, as a result, seriously erode the already shrinking market for both U.S. and Canadian cedar shakes and shingles.

The shake and shingle skirmish has its ironic side. Reagan and Mulroney both strongly advocate free trade. Bucking pro-tectionist sentiments in their countries, the two heads of government had authorized negotiations to tear down tariff walls. Their trade representatives were winding up the initial round of talks on the very day that the first shot in this bizarre little trade war was fired.

Here in Canada, Mulroney's finance minister, Michael Wilson, described the Canadian reponse as necessary to indicate to the Americans that yielding to protectionism does not come without costs. Canadian entrepreneurs said that had Mulroney consulted them first he would have been told Canadians, not Americans, would pay the price of the tariffs.

That the reprisals could end up backfiring on both sides of the border is not unusual, according to trade experts. They say the results illustrate the perils for governments that attempt to build tariff walls around struggling industries.

"The notion that an industry that gets tariff protection ends up being hurt happens more than one might expect," said Gary Hufbauer, an economics professor at Georgetown University.

What sometimes occurs when mature firms, like those in the U.S. cedar products industry, get tariff protection, is that foreign competitors respond by shifting to a slightly different product, Hufbauer said. Foreign clothing makers respond to U.S. quotas on cotton products by weaving an obscure fibre from a Southeast Asian nettle called ramie into their garments and evading the restrictions.

On those occasions when an industry is aided by a protectionist measure, he said, the consumers very often pay a heavy cost. Japanese auto manufacturers not only did not lose by agreeing to voluntary restraints on the volume of their exports to the United States, he said, they added about $4 billion in profits by jacking up car prices.

"The U.S. auto industry did well," he said, "but the Japanese auto industry did fabulously."

Canadian electronics manufacturers said that the problem with the tariffs Mulroney resurrected last week is that there is virtually no industry here to protect and firms will have to continue to import from the United States -- and pay the higher prices. Mulroney imposed a 5.4 percent tariff on certain semiconductors and a 3.9 percent duty on computer parts

"I have a hard enough time competing with the Japanese and Koreans and now my costs are going up," complained Lloyd Kubis of Motorola Canada, which imports microchips from the United States for the two-way radios and data products systems it manufactures.

"That's why I say we're shooting ourselves in the foot," he added. "Maybe we're masochistic."

About 70 percent of electronic component parts are imported, mostly from the United States, said John Reid, a spokesman for the Canadian Advanced Technology Association.

He said his association, a coalition of electronic manufacturers and academics, had been pleased in late January when Mulroney's government signed a trilateral trade agreement with the United States and Japan to effectively create a free trade zone in semiconductors and computer parts. They felt it would help them in their effort to enter into joint ventures with foreign firms to help Canada develop its embryonic high-tech industry.

"The government is moving us in the opposite direction and we would just like for them to cool it."

Canadian book publishers have been in the forefront of the noisy chorus of artists and intellectuals opposing Mulroney's earlier initiative to liberalize trade with the United States. They had warned that Canada's unique cultural identity was at stake. So it came as something of a surprise that the book publishers were back at the barricades last week to vehemently protest Mulroney's decision to slap a 10 percent tariff on books coming across the border.

"It's really an unmitigated disaster," said Serge Lavois, executive director of the Canadian Booksellers Association. "There's already price resistance among consumers."

"The concept of a tariff on books is abhorrent," said Marcia George, executive director of the Association of Canadian Publishers.

But, there are other reasons for the strong reaction of the Canadian publishing industry that they do not state quite so openly. The Canadian book market is dominated by American and British titles, and publishers often lose money when they publish Canadian authors but compensate for those losses by acting as the sales force, warehousers and distributors for American books.

Furthermore, many Canadian titles are printed jointly in the United States with U.S. publishers and will be subject to the tariffs too.

For example, both the U.S. and Canadian editions of the latest work by Canada's premier novelist Robertson Davies -- "What's Bred in the Bone," a best seller in both countries -- were printed in Illinois.

"The number of titles Canadian publishers do themselves is minimal," said Stanley Colbert, an American-born literary agent operating here. "They survive by functioning on behalf of American companies. There are a number of Canadian publishers that rely so heavily on it that they would have gone out of business without it."

The fight between Canadian and United States over red cedar siding and roofing is basically a battle for pieces from a shrinking pie. According to Mike Westfall, assistant manager of the Red Cedar Shingle and Handsplit Shake Bureau in Bellevue, Wash. The 320 U.S. and Canadian producers in his association -- who account for about 80 percent of sales in North America -- have seen demand dwindle to about half what it was a decade ago.

Competition from asphalt and tile roofing products, which are cheaper, and new concerns that cedar roofing is a fire hazard, have caused the erosion in markets, he said. Some communities in California and Texas, the primary markets, have banned its use, he said.

Virtually no one disagrees that the U.S. red cedar industry was dying a natural death even before these problems arose. Under the best of circumstances, nearly all of the century-old red U.S. cedar trees that are used for shakes and shingles will have been chopped down in 10 to 20 years. There is no incentive to replant since investors would have to wait 100 years to harvest.

By contrast, U.S. trade officials estimate there is a 100-year supply of cedar logs in Canada. Mills here have modernized and expanded in recent years, according to Westfall. Taking advantage of their economies of scale and of the lower Canadian dollar, they have grabbed a larger share of the dwindling market. In 1980, Canadian mills accounted for slightly more than half the market. Last year, they had nearly three-quarters of it.

Another group, the Northwest Independent Forest Manufacturers Association of Tacoma, Wash., filed a petition in September with the U.S. International Trade Commission bearing the names of 245 mill operators seeking relief from Canadian competition. The Tacoma group represents about a dozen U.S. red cedar mill operators, according to Gus Kuehne, executive vice president of the association.

Some of the mills whose names were on the petition had gone out of business. In their petition, the mills did not allege that the Canadians were engaged in unfair trade practices but charged only that they were being injured by the imports.

By a 4-2 vote, the ITC found that U.S. mills had been injured by the imports, but the commission was evenly divided over whether a tariff should be imposed, with dissenters recommending that Reagan instead should give operators subsidies for adjustment and retraining.

On March 25, Reagan announced his decision to impose a 35 percent tariff.

Westfall said his association would have preferred to resolve the problems by getting Canadian mills to agree to voluntary restraints. Canadian government officials flew to Washington to try to negotiate such an agreement but said they were rebuffed by administration officials.

In the two weeks since Reagan announced that the tariff would take effect June 6, this is what has happened in the red cedar shake and shingles market, according to Westfall and others:

*Canadian mills began operating on triple shifts, seven days a week. They have shipped a normal two-month supply into the United States during the last week and a half in an effort to beat the deadline.

*U.S. cedar loggers who would not quote prices immediately after the decision to impose the tariff was announced have since hiked them by an average of about 17 percent.

*Asphalt and tile roofers, some of them organized in trade groups with names like "The Committee for Fire Safe Roofing," have dropped their prices in some areas.