BEIJING (AP) _ China's best-known dissidents, physicists Fang Lizhi and his wife, Li Shuxian, left the country for Britain today after Communist authorities allowed them to end their yearlong refuge in the U.S. Embassy.

The White House immediately hailed Beijing's move as a ''humanitarian action'' that will better U.S.-Chinese ties.

The 54-year-old astrophysicist and his wife had sought refuge in the embassy after the June 4, 1989 military crackdown on the pro-democracy movement.

The official Xinhua news agency said they were given permission to leave the country for medical reasons after showing ''signs of repentance.''

It said the move was ''in line with China's policy of leniency towards those who participated in the disturbances'' of last June.

Since late last year, China has announced the release of more than 800 people jailed for their participation in the democracy movement, but it is believed that thousands more remain in jail.

Fang and Li were bound for Britain aboard a U.S. C-135 air transport.

The plane stopped briefly at Elmendorf Air Force Base in Anchorage, Alaska early today and transferred to another military plane with a fresh crew. The couple waved to onlookers but made no comments as they transferred planes, said Maj. Doug McCoy, an Air Force spokesman.

White House spokesman Marlin Fitzwater said Fang and Li would arrive in London early Tuesday. He said Fang had accepted a job at Cambridge University.

''This humanitarian action is a far-sighted, significant step that will improve the atmosphere for progress in our bilateral relations,'' he said in a statement, adding that President Bush was informed of the development late Sunday.

He did not disclose when or how the agreement to allow the couple free passage had been reached.

Fang has been China's most outspoken and eloquent proponent of democratic reform. He and Li were well known for their advocacy of democracy and human rights in China well before the seven-week pro-democracy movement gelled.

Hundreds of unarmed civilians were killed in the military assault on central Beijing and thousands of activists were subsequently arrested. Fang and Li did not play an active role in the student-led protests, but after the crackdown the the Communist government accused them of inciting the unrest.

They took refuge in the U.S. Embassy in the days following the crackdown, and American diplomats refused to turn them over to Chinese authorities. Washington also imposed sanctions that cut shipments of military hardware and U.S.-Chinese relations deteriorated.

Their release appeared timed by the Chinese for maximum political results. The seven leading industrialized nations are to hold their annual meeting July 9-11 in Houston, and policy toward China is to be a major subject.

Congress is also debating Bush's decision last month to extend most- favored-n ation trading status to China for another year. The Fang case has been cited by some members of Congress demanding revocation of the status, which reduces tariffs on Chinese goods sold in the United States.

Chinese authorities had said that in order to be released, Fang and Li would have to confess ''guilt'' and promise not to carry out any anti- government activities.

Xinhua said the two had recently admitted in writing that they have opposed socialist principles and the leadership of the Communist Party, thus violating the country's constitution. It also said the two had agreed not to engage in ''activities directed against China.''

The report did not say what their medical problems were. Their son Fang Ke, a student at Wayne State University in Detroit, said earlier this month that his parents were in good spirits and continued their scientific work in the embassy.

''I am happy to see the very real possibility for me in the near future to see them,'' he said today.

Fang Ke said he doubted the Chinese government's explanation that his parents were allowed to leave because they had repudiated their role in the democracy movement and needed medical care. He said he had kept in touch with them by letter and that they were not particularly ill.

Fang has another son in Beijing, Fang Zhe, a student at Beijing University. In Britain, a Foreign Office spokesman said Fang had received an invitation from the Royal Society, Britain's oldest and most prestigious scientific organization.

However, Fang and his wife, Li Shuxian, would enter the country on a six- month visa, the standard time granted any tourist, the Foreign Office said.

Fang was expelled from the Communist Party and fired from his post as vice chairman of the Chinese Science and Technology University in Hefei in 1987 for allegedly fomenting pro-democracy unrest among the nation's students.

He also angered authorities when he told reporters that Marxism had failed in China and that the Communist Party must make way for democratic reform.

In January 1989, Fang called for the release of all political prisoners, and urged intellectuals to join together to work for human rights.

The following month, when Bush was visiting Beijing, Fang was barred from attending a U.S.-staged banquet. China said that inviting him was an insult.

While being sheltered at the embassy, Fang and Li declined to talk with reporters and the embassy refused to answer nearly all questions about them.

In November, however, Fang wrote a letter accepting a human rights award.

''Remember that in the current climate of terror, it may well be that those who are most terrified are those who have just finished the killing,'' he wrote.

''We may be forced to live under a terror today, but we have no fear of tomorrow. The murderers are not only fearful today, they are even more terrified of tomorrow.''

The release of another dissident, teacher Wang Xuezhi, was also announced today. Wang is the husband of a French citizen.