U.N. Secretary General Javier Perez de Cuellar said today his talks with Soviet leader Yuri Andropov have left him feeling "encouraged" about prospects for resolving the Afghanistan problem.

Speaking at a news conference at the end of his two-day visit, Perez de Cuellar said his extensive discussions with Andropov and Foreign Minister Andrei Gromyko indicated "real interest" by Moscow to reach a political solution "around Afghanistan."

A new round of indirect talks conducted under U.N. auspices between the Soviet-backed government in Kabul and Pakistan is due to resume in Geneva in two weeks. Diplomats here said these talks, conducted by U.N. Undersecretary General Diego Cordovez, are expected to enter a decisive stage.

Perez de Cuellar did not disclose any details of his conversations with the Kremlin officials nor did he indicate the reasons for his optimism. "Rely on me. I have reasons for hope," he said. "I feel encouraged in a sense that I got renewed encouragement for our efforts to press for a solution around Afghanistan." He said his previous visits to Pakistan and Afghanistan indicate that these two countries also showed "real interest in helping my efforts."

Perez de Cuellar said one of the elements of the Afghan crisis was the presence in Afghanistan of an estimated 100,000 Soviet troops. He said it would be "naive" to think that "Andropov will withdraw Soviet troops tomorrow."

Perez de Cuellar conferred with Andropov and Gromyko for two hours yesterday and met again with Gromyko today for a three-hour session. Diplomatic observers here said they saw no signs of an early breakthrough nor were there hints that Moscow was prepared for any changes in Afghanistan's internal situation.

According to diplomatic sources, some progress has been made in the indirect talks on procedural matters involved in the return to Afghanistan of more than 2 million refugees in Pakistan.

The indirect talks, according to this view, now involve the issues of voluntary return of refugees, reciprocal guarantees of noninterference and some form of guarantees on Afghanistan's future. The Pakistanis are said to be seeking the addition of the question of Soviet forces in Afghanistan, something Moscow is unlikely to accept.

Perez de Cuellar, who served as Peru's ambassador to Moscow for four years before moving to the United Nations, said such a dialogue "must begin as soon as possible."

The Soviet news agency Tass quoted Perez de Cuellar as saying that he had found Andropov a sharp-witted man. "I appreciate his knowledge of international problems, his sharp intelligence and even his sense of humor," he was quoted by Tass as saying.