Defense Secretary Caspar W. Weinberger has formally invited his Soviet counterpart to visit the United States this year to discuss "the wide gulf on issues related to each other's military forces, doctrine and intentions," the Pentagon said yesterday.

Defense Department spokesman Robert B. Sims said Soviet Defense Minister Sergei Sokolov has not responded to the invitation, issued earlier this month. "We hope Marshal Sokolov will accept," Sims said.

The visit apparently would be the first by a Soviet military chief. Pentagon historians said that their "initial reading is that no Soviet defense minister has previously visited this country either as part of a summit or a ministerial level exchange."

If Weinberger and Sokolov find a meeting constructive, the Pentagon said, Weinberger plans to follow up with meetings of U.S. and Soviet generals and admirals, and Soviet officers may even be invited to lecture at U.S. military academies.

The Soviets have attacked Weinberger almost continuously over the last five years portraying him as an anti-Soviet hard-liner who has stood in the way of improved relations between the two superpowers. Pentagon officials conceded that it would be ironic if Weinberger promotes the first mini-summit with his Soviet counterpart.

Asked why Weinberger chose this particular time to issue the invitation, as he urges President Reagan to abandon the weapons limits in the U.S.-Soviet SALT II treaty and hike the Pentagon budget, Sims responded with a written answer:

"As President Reagan stated before the Congress and American people upon his return from Geneva: 'With all that divides us [the United States and Soviet Union], we cannot afford to let confusion complicate things further. We must be clear with each other and direct.' The Secretary agrees with this approach.

"As the Geneva meeting demonstrated," Sims continued, "a direct airing of our respective views, perhaps especially where there are disagreements, may contribute to better understanding."

If Sokolov accepts the invitation, Sims added, the two defense leaders might meet as part of any summit meeting between Reagan and Soviet leader Mikhail Gorbachev.

Sims said Weinberger sent the invitation to Sokolov in "through diplomatic channels in late May. Given the particularly wide gulf that that separates our views on issues related to each other's military forces, doctrine and intentions, the secretary believes it would be useful to establish a dialogue with the Soviet defense minister."

Another impetus for issuing the invitation came from Congress. Its fiscal 1986 defense authorization bill, enacted last year, requires Weinberger to submit a plan for the exchange of high-ranking civilian and military officials from the Pentagon and Soviet defense ministry.

In letters recently sent to the chairman of the House and Senate armed services committees, Weinberger said annual meetings between U.S. and Soviet naval officers have proved useful in reducing Soviet harassment of U.S. ships.

He cautioned, however, that "it would be highly unrealistic to expect that a dialogue between high-level defense officials or military officers would bridge by itself the vast gulf that divides us." But he said a wider dialogue between the leaders of the world's two biggest military establishments "may allow us to understand each other better and to address more effectively current and future problems of a military nature."