LONDON (AP) _ Prime Minister Margaret Thatcher was quoted today as labeling ambitions expressed by President Reagan and Soviet leader Mikhail S. Gorbachev to scrap all nuclear arms as unrealistic ''pie in the sky.''

The Times of London quoted the British leader as saying in an interview, ''Both the president (Reagan) and Mr. Gorbachev have said that they want to see a world without nuclear weapons. I cannot see a world without nuclear weapons.''

''Let me be practical about it. The knowledge is there to make them. So do not go too hard for that pie in the sky because, while everyone would like to see it, I do not believe it is going to come about,'' she was quoted as saying.

But the newspaper reported that Mrs. Thatcher said she accepts the American proposal to eliminate all superpower medium-range nuclear missiles within three years. It quoted her as saying, ''There is room for getting down the intercontinental ballistic missiles on both sides.''

Mrs. Thatcher told Gorbachev in a letter delivered in Moscow on March 10 that the goal of a nuclear-free world was necessarily long-term, and that in the foreseeable future, nuclear weapons as deterrents would continue to make an essential contribution to world peace and stability.

Her letter signaled that her Conservative government had joined the Reagan administration in expressing strong reservations over Gorbachev's plan announced on Jan. 15 to rid the world of nuclear arms in stages by the year 2000.

Mrs. Thatcher said in the letter that a key condition of the Gorbachev plan, a freeze on any buildup of Britain's independent nuclear deterrent, was unacceptable.

In addition to U.S. cruise missiles and bombers equipped with nuclear weapons stationed on British soil under NATO agreements, Britain has its own nuclear deterrent. France also maintains an independent nuclear force, and has also expressed opposition to the Gorbachev proposal.

On Thursday, in a letter to U.N. Secretary-General Javier Perez de Cuellar, Gorbachev said the Kremlin was ready to negotiate a nuclear test ban and the dismantling of superpower medium-range rockets in Europe ''without any linkage,'' a term the Soviets have used in the past to refer to limits they seek on British and French arms.

Britain's nuclear deterrent currently consists of an aging Polaris submarine fleet equipped with missiles. But Mrs. Thatcher's government plans to replace the flotilla by the mid-1990s with a more powerful Trident submarine-launched missile system bought from the United States.

The new system will cost the equivalent of $14.6 billion at current estimates.

Part of Gorbachev's Jan. 15 plan called for the United States to agree not to transfer nuclear missiles to other countries, which would mean the cancellation of Britain's Trident program.

But Reagan, who had originally welcomed Gorbachev's plan, said in a Feb. 24 reply to the Soviet leader that many of its details ''are clearly not appropriate for consideration at this time,'' and said many obstacles remained in the path of total nuclear disarmament.

Gorbachev's disarmament plan put forth a ''zero-zero'' option - the elimination from Europe of U.S. medium-range cruise and Pershing 2 missiles and medium-range Soviet rockets.

In The Times interview, Mrs. Thatcher was quoted as saying, ''We said right at the beginning that if the Soviet Union got rid of her intermediate missiles then there would be no cruise or Pershings, and that really is the zero-zero global option, and we are reverting to that, so it is not a new option.''