American government, military and university specialists warned yesterday that the nation is in danger of losing its older scholars in Soviet affairs without replacing them with enough fresh talent at a time when a new generation of leaders is about to emerge in Moscow.

The specialists gathered on Capitol Hill to testify before a Senate subcommittee headed by Sen. Richard G. Lugar (R-Ind.), who is cosponsoring a bill that would use government funds to set up a $50 million endowment to support advanced Soviet studies in this country.

"The hard truth is that our national capacity to analyze the views and actions of our primary adversary . . . is seriously eroding," Lugar said. "Nearly half of the recognized academic experts currently working on Soviet affairs will be dead or retired by the end of the 1980s, and there are few new students to replace them."

Lugar, who chairs the Senate Foreign Relations European affairs subcommittee, claimed that the Soviets have more than 7,400 specialists on America working with 12 Moscow research institutions. While he gave no comparable U.S. statistics, Lugar said that fewer than 200 Americans will complete doctoral-level training in Soviet studies this year.

Referring to the proposed legislation, Dr. Howard R. Swearer, president of Brown University, told the panel that "if you don't do something like this soon," the structure of expertise on Soviet matters built up over the last 20 to 30 years "will begin to crumble."

"The best young people are not going into it" anymore, Swearer said, as funds from private organizations such as the Ford Foundation, which once spent $40 million a year on such studies but now spends about $2 million, seem "gone forever." Graduate student competence in the Soviet language is also on the decline, he said.

Retired admiral Bobby Ray Inman, former deputy director of the Central Intelligence Agency, testified that while the United States was good at technical intelligence, there have been many times when the country was "subject to surprise because we did not understand events," and there have been "many occasions when we underestimated what the Soviets would eventually do."

The fault, he said, frequently could be found in the tendency of well-intentioned analysts to do "mirror-imaging" based on their experience but not on a real understanding of what motivates individuals in other societies.

Maj. Gen. William Odom, assistant Army chief of staff for intelligence and a member of the White House National Security Council staff under President Carter, agreed that "the big intelligence failures of the 1980s and 1990s . . . are likely to be in analysis."

Odom bemoaned the boom-to-bust nature of Soviet studies in this country and said the crucial need is quality rather than quantity.

The endowment is meant to be self-sustaining after the initial appropriation, with interest from the $50 million supporting the studies.