Former White House aide Michael K. Deaver has resigned as a lobbyist for the government of Canada, saying he wants to spare the Canadians further embarrassment in the controversy that has led to a criminal investigation of him on conflict-of-interest charges.

Deaver's $105,000-a-year contract with Canada, which made him a foreign agent on the acid-rain issue he had dealt with in the White House last spring, was to expire June 30 and was unlikely to be renewed by the Canadians. But Deaver preempted any decision by informing Canadian Ambassador to Washington Allan Gotlieb that he would not seek to renew the contract, Deaver's spokeswoman, Pamela G. Bailey, said yesterday.

In a letter released by the Canadian Embassy here, Deaver said that "various news reports and allegations that there was ever anything improper about our work for Canada has been a source of great disappointment and regret . . . I wish to spare the prime minister and his government any further involvement in this controversy."

The loss of Canada is the latest setback for Deaver's Washington consulting firm, which in recent months has lost Mexico and Singapore as clients after registering as a foreign agent for both countries at fees of $250,000 apiece. Sources also said yesterday that Deaver is working on a book about President and Nancy Reagan, whom he has known for 20 years. The sources confirmed a report by New York Times columnist William Safire that Deaver has received a $500,000 advance from the William Morrow publishing company on the book. Deaver stirred controversy in 1983 when, as White House deputy chief of staff, he signed a contract to produce a diet book, which was never written.

Deaver, whose contracts with foreign interests require him to be the "principal officer" for his firm's clients, is now spending much of his time on his legal defense, sources say.

Deaver, who was known as a public relations wizard when he was White House deputy chief of staff, headed off what had grown into a political furor in Ottawa and a potential embarrassment to him if Canada refused to rehire him. In similar fashion, Deaver had urged that an independent counsel be named to investigate him after such an appointment appeared inevitable, but before Whitney North Seymour Jr. was tapped for the job this month.

In his letter to Gotlieb, Deaver said he had tried to provide "ethical and high-quality service to you and to all my clients. I am confident that the independent counsel will conclude the same." Seymour's mandate, however, is to determine whether Deaver should face criminal prosecution, not determine the ethics of his actions.

Canadian Embassy spokesman John Fieldhouse said the letter was unexpected and called for no reply. "It was a spontaneous act on Mr. Deaver's part," he said.

The Justice Department and the General Accounting Office earlier this spring found evidence that Deaver may have violated federal law by representing Canada on the acid rain controversy, after he had played a substantial role on the issue while he prepared the White House for a U.S.-Canadian summit. Investigators also said Deaver may have violated the law by meeting on Canada's behalf with Drew Lewis, a presidential envoy on acid rain whom Deaver had helped select.

Similar questions have been raised about Deaver's role in helping select U.S. ambassadors to four countries in which he later sought business. As a member of a small White House-State Department group, Deaver helped approve the ambassadors to Canada, West Germany, India and Singapore.

A House subcommittee plans to travel to West Germany to take sworn testimony from U.S. Ambassador Richard R. Burt about Burt's ssistance to Deaver in seeking a contract there. While in the White House, Deaver also hired Gahl Hodges, now Burt's wife, to be Nancy Reagan's social secretary.

Last February, Burt invited Deaver to bid for a contract to publicize the city of Berlin's 750th anniversary, and put him up at the ambassadorial residence in Bonn. Burt told The New York Times, which disclosed the incident, that he set up meetings for Deaver with German officials, but that he also helped competing firms.

One competitor, Gray & Co., had to seek the contract on its own, a spokesman said, although its lobbyist knows Hodges and stayed at the ambassador's residence. "We frankly heard that Deaver was very inside on the contract" and considered forgoing the competition, he said.

The Energy and Commerce subcommittee on oversight and investigations will also go to Tokyo to question U.S. Ambassador Mike Mansfield, who warned the State Department that a Deaver lobbying mission in Tokyo ran counter to U.S. policy. The panel has asked the department for all cables between Mansfield and Secretary of State George P. Shultz on a plan, supported by Deaver, to have Japan grant tax breaks to Japanese companies investing in Puerto Rico.

Shultz said in a cable to Mansfield that the "Embassy's concern over the appropriateness of supporting Puerto Rico's efforts" was "well founded." Shultz said Deaver would be told that the United States opposes all such tax agreements and that Puerto Rico, as a U.S. territory, cannot negotiate its own international pacts.

In a related development, the mayor of San Juan has asked Seymour and the Securities and Exchange Commission to investigate whether a large brokerage house used Deaver as "bait" to win a contract to underwrite a $500 million bond issue in Puerto Rico.

Mayor Baltasar Corrada del Rio also charged that the firm, Smith, Barney, Harris, Upham & Co., may have inflated its $975,000 fee to the commonwealth as a way of paying Deaver's fee. The company denied the charges.

Deaver's firm was "loaned" to Puerto Rico by Smith, Barney, which hired him two weeks after he left the White House in May 1985, and paid his $300,000 fee. Deaver lobbied the administration to preserve tax breaks for U.S. companies in Puerto Rico in its tax-revision bill, contacting then-national security affairs adviser Robert C. McFarlane and arranging a meeting for Gov. Rafael Hernandez Colon with Treasury Secretary James A. Baker III.

Later, Puerto Rico selected Smith, Barney to be managing partner for a $500 million bond issue last November. Corrada questioned whether "Mr. Deaver was paid for his lobbying efforts on behalf of Puerto Rico with the proceeds of this bond issue."

Corrada, a political opponent of Hernandez Colon, cited criticism from industry officials that the $975,000 in underwriting fees charged by the firm was about $300,000 higher than usual for such a bond issue.

Robert E. Connor, first vice president of Smith, Barney, said the fees were reasonable and that "Deaver's fee for Smith, Barney had nothing to do with that particular issue."

"We had to compete for the business and we won it," Connor said. "There were no winks, no handshakes, no secret agreements." He said Deaver was hired because the Puerto Rican tax break was "a critical issue" for his firm, a major bond underwriter.