President Reagan yesterday apologized in a private note to Prime Minister Brian Mulroney for failing to notify him in advance of a decision to impose duties on Canadian cedar products, but administration officials insisted that the tariffs were justified by U.S. and international trade laws.

The Reagan note to Mulroney appeared to be an attempt to defuse what threatens to become a major trade war between the United States and Canada, the world's two largest trading partners.

U.S. Trade Representative Clayton Yeutter yesterday accused the Mulroney government of overreacting to Reagan's decision 10 days ago to impose tariffs on imports of Canadian shakes and shingles. Canada retaliated Monday by slapping its own tariffs on books, magazines, computer products and other imports from the United States, and now U.S. trade officials are considering counter-retaliatory moves.

While little noted here, the U.S. tariffs created a political firestorm for the Mulroney government, especially since they came immediately after the start of what promises to be very difficult negotiations over an agreement that could wipe out all trade barriers between the two neighboring nations.

Canadians, always sensitive about the potential for economic domination by the United States, saw the Reagan tariff action as a show of strength to influence the talks.

Mulroney, apparently caught unawares by the U.S. trade move, responded with a sharp "Dear Mr. President" letter to Reagan that stood in marked contrast to the usual "Dear Ron" tone of his communications.

While acknowledging their failure to specifically notify Mulroney in advance of the decision to impose tariffs on shakes and shingles, administration officials said Canada should not have been surprised.

The decision arose from a petition by domestic manufacturers of similar products, whose sales have been devastated in recent years by low-cost imports from their Canadian competitors, for relief under U.S. and international trade laws.

The International Trade Commission, after proceedings in which the Canadians took part, recommended that Reagan grant the domestic industry a straight 35 percent tariff for three years. But Reagan took a less harsh stand, ordering sliding tariffs that start at 35 percent and go down to 8 percent for the final six months of a five-year period.

"We clearly had the right to take the action that was taken," Yeutter said in a telephone interview. He added that hundreds of similar actions have been taken by the United States and other countries "when an industry is inundated by imports and needs breathing space to regain its competitiveness."

Yeutter brushed aside as "not a defensible explanation" Canada's complaint that the start of free-trade talks shielded it from any trade actions by the United States.

"I hope they are not going into the talks with false expectations," Yeutter said. "Our objective is to move as far as we can toward free and open trade. . . . "

Yeutter said the administration was studying possible counter actions. But he softened the U.S. position by indicating that the administration might not retaliate if the Canadian action "in any reasonable way mirrors" the American tariffs. "If they are relatively in line, we have no reason to complain, in the sense that they would balance each other," he added.