The Folger Shakespeare Library will announce today that it will keep the Folger Theatre open for two more years, reversing a decision to close the classical theater at the end of the current season. Word that the theater would fold had provoked widespread and continuing protest since mid-January.

According to library director Werner Gundersheimer, the board of trustees of Amherst College, which governs the prestigious institution, has agreed to contribute $300,000 in cash to the theater group over the next two years. In addition, it will pay the $260,000 needed for maintenance and upkeep of the 253-seat facility over the same period.

The library will also work with a newly formed committee, headed by Washington attorney R. Robert Linowes, to put the theater on independent financial footing by the end of the 1986-87 season. Gundersheimer said an anonymous donor has pledged $100,000 -- to be matched on a 3-to-1 basis -- to help the theater through the two-year transition.

The announcement represents a dramatic turnaround for the Amherst trustees, who had asserted earlier that the Folger Theatre was an unacceptable drain on the library's resources and that the unpredictability of the theater's annual operating deficits made it impossible to plan the library's budget. (In its 15-year existence, the theater group's yearly losses, which have been assumed by the library, have ranged from $40,968 to $493,000.)

About 60 of the theater company's 75 members, summoned late yesterday afternoon for an impromptu meeting in the theater's Elizabethan quarters, greeted the news with applause and visible surprise. "We've been under such an awful strain for the last six weeks," said actress Mikel Lambert tearfully. "I'm incredibly relieved and terribly grateful."

The 18 members of the Amherst board of trustees had anticipated a negative response to the initial decision to close the Folger Theatre, but the size and scope of the reaction were apparently instrumental in prompting them to reconsider. Individual theatergoers have sent in donations and written letters of protest, the City Council recently passed a resolution in support of the theater, and a cabinet member and a senator agreed last month to head Folger Audience, a private effort to save the theater.

"The trustees were in an uncomfortable position of having to balance the goods -- the good of what is essentially a research institution against the good of preserving a classical theater," explained John Callahan, the board's secretary. "If people had yawned and said it doesn't matter, if there had been no reaction, this decision would have stood. The fact that there was such deep concern was very important in arriving at this solution."

Also instrumental in causing the turnaround was the willingness of Linowes to assume the leadership of what will be called the Steering Committee for the Shakespeare Theatre at the Folger Library. The committee will set up an independent board of directors for the theater, which will be responsible for any future deficits. According to Gundersheimer, Linowes' willingness to assume a major role "made all the difference."

In the next 10 days, Linowes plans to appoint nine to 15 members to the committee, which will include representatives of the Folger Library, Amherst trustees, community and business leaders and individuals connected with Folger Audience.

In an official statement released yesterday, Folger Audience, headed by Sen. Daniel Patrick Moynihan (D-N.Y.) and Transportation Secretary Elizabeth Hanford Dole, applauded the library's "change of mind as a welcome basis for discussion" but cautioned "this does not by itself assure a viable theater. Unfortunately, Amherst and the library do not as yet say what they will do on their part to keep the Shakespeare theater going after this two-year period of grace." To date, Folger Audience has raised approximately $11,000 in gifts and pledges.

Gundersheimer said the library would reassess its role in the theater's fortunes at the end of the two years, but restated his conviction that "the library's participation must decrease, not increase." For the first time in its history, he said, the library anticipates an operating deficit of approximately $226,000 next year, due in part to its planned contributions to the theater.

Nonetheless, Gundersheimer hailed the new arrangement as "one of those few solutions in which everyone wins. The theater continues; it gets local support. The library can do rational planning and benefits from having live Shakespeare in a unique space. I had hoped all along there would be a positive outcome. I have not enjoyed being depicted as a carpetbagger or a philistine who has come to destroy the local culture. I hope that perception will change in the months to come."

"Obviously, we're thrilled," the theater's managing director, Mary Ann de Barbieri, said yesterday. "But we've got a lot of work ahead of us. In one sense, it's a new theater we're talking about, and yet it's 15 years old." Despite the library's two-year pledge of support, the theater will still be heavily dependent on outside fund-raising. Currently it relies on $425,000 in contributions and grants annually to stay afloat; officials estimate that another $200,000 a year will be required to balance a budget that is approaching $2 million.

"Initially, I don't anticipate any radical changes, but I think we can look to bigger things in the future -- expanding the resident company, attracting more respected names to work at the theater, maybe touring," said the Folger's artistic producer, John Neville-Andrews. "From an artistic point of view, I feel now that I can tread without fear."

The terms under which the Folger Theatre will continue to exist were hammered out over the last three weeks in a series of meetings, coordinated by the Eugene and Agnes E. Meyer Foundation and characterized, according to one participant, by "a reasonable amount of friendly back-and-forth, done in complete candor." The library, which from the start was willing to earmark $50,000 a year for some form of reduced theatrical programming, was persuaded to increase that sum to $150,000. In return, it wanted -- and got -- assurances that the long-term financial responsibility for the theater would be taken over by community leaders.

Linowes said he expects "a national, not just a local, reponse" to future fund-raising efforts for the Folger Theatre. "It's not going to be easy, but I think we are going to pull it off."

Planning for the coming season, which had been suspended, can now resume, said Neville-Andrews, who will announce the Folger's 1985-86 schedule "as soon as possible." It will be made up of five classical plays -- three by Shakespeare.

In a related development, Rep. Mary Rose Oakar (D-Ohio) will hold hearings on Monday on legislation that would authorize the secretary of the Smithsonian to transfer $500,000 to the Folger Theatre. A spokesman for Oakar said yesterday that the hearings would go on as scheduled and the library's decision "just illuminates the problems more strongly."

Company members celebrated the two-year reprieve in the library's Great Hall by drinking champagne supplied by Gundersheimer.