Chancellor Helmut Kohl declared today that West Germany and the United States have reached basic agreement on a pact governing his country's participation in President Reagan's research program for space-based missile defense.

The accord will make West Germany the second European ally to join the administration's Strategic Defense Initiative. But unlike the first, Britain, Bonn will restrict its participation to private companies, with no government role.

Following two hours of talks with U.S. Secretary of Defense Caspar W. Weinberger, Kohl said several key problems concerning the involvement of West German firms in the so-called "Star Wars" research plan were resolved in today's talks.

Speaking to reporters in the Bavarian town of Grafenwoehr, where he and Weinberger observed German-American military exercises, Kohl said that Economics Minister Martin Bangemann would conclude the deal in Washington next week.

Sources involved in the negotiations said Bonn and Washington would sign two documents under the agreement. One would outline Bonn's backing for private German companies taking part in the "Star Wars" program. The second would proscribe the sharing of research findings and the use of technology developed under the SDI contracts.

As recently as last week, the German-American negotiations appeared likely to drag well past the Easter deadline that Kohl's government imposed when they began in January. West German officials complained that the U.S. negotiators, led by Richard Perle, assistant secretary of defense for international security policy, were inflexible over patents and "rights of use" issues -- that is, whether German firms could apply SDI research for commercial purposes.

The Bonn government, which conducted the talks through its Economics Ministry, views participation in "Star Wars" chiefly as an opportunity for German companies to stay abreast of new technologies. Washington, however, sees the program as a military venture and wanted primary links established with Bonn's Defense Ministry.

Weinberger reportedly wanted to sign the accord with his West German counterpart, Manfred Woerner, as he had done with Britain's former defense secretary, Michael Heseltine, in an attempt to underscore the allies' endorsement of SDI's military objectives. But Bangemann's Free Democratic Party, partners in Kohl's center-right ruling coalition, insisted that Bonn's participation must be channeled through the Economics Ministry.

The argument carried important political connotations here. Any failure to reach an agreement on commercial grounds would have been perceived here as a serious blow to Kohl, whose political fortunes already are sagging under the weight of two investigations by prosecutors into perjury allegations.

American officials said they were aware of Kohl's predicament and did not wish to embarrass him or harm his government's prospects in next January's election.

Reflecting his anxiety about the fate of the SDI accord, Kohl wrote a letter to Reagan last Wednesday urging greater cooperation in reaching an early agreement. U.S. officials said Reagan then ordered a more conciliatory posture.