Just as presidential aides were calming the outrage on the religious right caused by inviting homosexual activists to the Oval Office for a bill-signing, Barbara Bush wrote a letter to a representative of the gay lobby who had attended the White House ceremony.

The first lady was answering a repeated request from Paulette Goodman, president of Parents and Friends of Lesbians and Gays, to ''speak kind words to some 24 million gay Americans and their families.'' Wrote Mrs. Bush, ever warmhearted: ''We cannot tolerate discrimination against any individuals or groups in our country.''

To Republican politicians and worried White House aides, those words pushed the Bush agenda into political danger. The critics by no means condone gay bashing or intolerance of private sexual preferences. But, House Republican Whip Newt Gingrich argues, any appearance of the president's sanctioning homosexual life styles with the same civil rights protection afforded race and gender is ''insane.'' He and other GOP politicians are stunned that the president could be seen joining Democrats on the wrong political side of this cultural confrontation.

That was the perception of conservative religious leaders, who have strongly supported Republicans in the last three presidential elections, when they learned the Gay and Lesbian Task Force was represented at the White House April 24 for signing of the ''hate crimes'' bill. The revelation had special resonance for the Southern Baptist Convention, which only five days earlier (at the request of the White House) had invited the president to address its June conference in New Orleans.

A quick complaint came from Richard Land, executive director of the Southern Baptists' Christian Life Commission. ''The White House,'' Land wrote the president on April 30, ''should not be giving its sanction and implicit approval to such groups.'' Then came a telephone call to the White House from the Rev. Jerry Vines, the Southern Baptist president, suggesting that objections to the presence of the gays be considered when the president answered the invitation.

On May 11, Vines got the reply: Bush would not be at the Louisiana Superdome. Doug Wead, the president's religious liaison, told us animosity toward Bush from a strong liberal Baptist faction, as well as ''scheduling problems,'' contributed to the no-show. But there is no doubt the gay question was what turned the president away from the invitation he had solicited.

Did the gays' presence at the White House upset Bush's friends on the right, such as the Rev. Jerry Falwell? ''I would have been upset had I thought the president had initiated the invitations,'' Falwell told us. He said Wead told him the bid came from presidential aides. Beyond that, New Right activist Paul Weyrich was informed by a presidential aide that the White House now feels inviting the gays was a mistake (though other aides there disagree strongly). Just as those assurances were calming the right, enter Barbara.

The first lady had received a letter from Paulette Goodman a year earlier asserting the need to ''educate the public with facts about homosexuals.'' Dissatisfied with a form letter from Mrs. Bush's secretary, the gay-lobby activist used her presence at the April 24 bill signing to hand a White House staffer a copy of the original letter to the president's wife. It worked. On May 10, Mrs. Bush wrote: ''I appreciate so much your . . . encouraging me to help change attitudes.''

Presidential aides who are paid to know everything expressed genuine surprise -- and dismay -- when we told them about Mrs. Bush's overture.

In fact, her letter supplements but does not change Bush's course. ''He is a good guy who wants everybody to support him,'' a GOP leader told us about Bush's bid to the gays. Newt Gingrich will now work to convince him that in reaching out to gays, he risks estranging his core constituency along with the uncommitted middle.