West German Chancellor Helmut Schmidt will visit Soviet President Leonid Brezhnev in Moscow for two days beginning June 30, informed sources said today.

The trip, which has been the subject of intense speculation here for weeks, is expected to be used by Schmidt to probe for Soviet flexibility on pullout from Afghanistan and on the chances for future disarmament talks. Preparation for this autumn's Madrid follow-up conference to the 1975 Helsinki accord is also a major item on the German agenda.

The Soviets are likely to test the depth of strain between Bonn and Washington and to reinforce the special brand of detente that has grown up between Bonn and Moscow during the past decade.

While Schmidt's aides have sought to reduce expectations that anything concrete will result from the meeting, pressure on the West German chancellor to come back from Moscow with something tangible has mounted since President Valery Giscard d'Estaing of France saw Breznev in Warsaw last week without any apparent solid Western gain.

The opposition Christian Democrats, facing a difficult national election in October, have made Schmidt's handling of relations with Washington and Moscow a key campaign issue. The party has charged Schmidt with neglecting U.S. ties and "neutralizing" Europe.

Since April, when Brezhnev renewed his 2-year-old invitation to Schmidt, the chancellor has consulted with President Carter and other Western leaders to allay concern and win support for his trip. But U.S. officials are known to be cool about the mission.

Washington Post correspondent Kevin Klose reported from Moscow:

Brezhnev declared tonight that t political settlement in Afghanistan, "is quite possible" but he repeated that any Soviet troop pullout hinges on prior international guarantees against alleged foreign aggression there.

In a Kremlin speech to visiting South Yemeni leader Ali Naser Mohammed, Brezhnev said, "To those who now call for an end of the Soviet military assistance to Afghanistan, even if prompted by honest motives, we say: It is necessary first to ensure that the reasons which necessitated this assistance be removed.' Political settlement is quite possible. Its essence is the guaranteed ending of armed invasion into Afghanistan by forces of counterrevolution from the territories of neighboring states."

This formulation may be of interest to Western leaders in part because of its imprecision after months of categorical Kremilin position. But Brezhnev repeated Moscow's condition of Carter administration defense policies, asserting, "If the world situation has now considerably aggravated, the main reason for this is the militaristic course of the United States."