LONDON, JAN. 15 -- Nearly 100 Conservative members of Parliament defied Prime Minister Margaret Thatcher today, rejecting party orders to vote against legislation governing official secrecy.

Although Thatcher won the vote with a majority of 37, it marked the most serious revolt of Conservative backbenchers since her reelection last June.

The government currently has a majority of 102 in the 650-member Parliament. While today's 271-234 vote gave Thatcher a "mathematical victory," in the words of one commentator, it amounted to a "moral defeat."

The dispute over secrecy comes at a time when Thatcher faces unhappiness within her party over other issues, including government legislation that would radically change Britain's education and local tax systems. Although there is little doubt that she will win votes on these issues later in the year, today's rebellion was seen as a precursor to rocky times ahead.

The focus of the controversy was a "private members" bill, introduced by Conservative Richard Shepherd to change the Official Secrets Act of 1911. The government has described the act as "inefficient and unenforceable" but opposed Shepherd's bill and declined to specify its objections to it. It has failed to propose its own legislation.

In a five-hour debate preceding the vote, Home Secretary Douglas Hurd said the government would introduce new legislation this year and that it felt such a task was too sensitive and important to be left to individual members of Parliament.

Some Conservative rebels said they doubted the Thatcher government's commitment to narrowing the all-encompassing 1911 law and charged that its overzealous defense of official secrets had made Britain look ridiculous. The government currently is involved in at least a dozen court cases against British newspapers for publishing classified information that was openly available in other countries.

Others said their principal objection was to the heavy-handed tactics Thatcher used to defeat the bill, along with the implication that some issues were beyond the purview of Parliament.

Former Conservative prime minister Edward Heath joined two former Thatcher Cabinet ministers and 16 other Tory members who, along with virtually the entire opposition, voted for the bill. An additional 80 Conservative members abstained or did not attend the session.

Both actions amounted to blatant defiance of strict party discipline, imposed in the form of a "three-line whip" obliging Conservative members both to show up and to cast their votes as instructed.

Such strictly obligatory voting is normal practice here on those matters over which the government seeks a strong and unequivocal majority. In terms of parliamentary courtesy, however, it is virtually unprecedented for such action to be taken to kill a private bill introduced by a member of the government's party.

Shepherd, who had twice declined Thatcher's request to withdraw the bill, said tonight that the prime minister had asked Parliament "to jump like a puppet at {the government's} behest when there is no serious government proposition.

"That was unacceptable to a large number of my colleagues," Shepherd said. "I never doubted that Parliament would stand up for itself. I am sorry we could not get more."

Unlike the United States and several other western democracies, where a recognized public right to know supersedes a government right to secrecy in all but demonstrable cases of damage to national security, all information emanating from the government in Britain is deemed to be officially secret.

Section 2 of the Official Secrets Act makes it a crime for any government employee to disclose any information without authorization.