In a striking shift, Margaret Thatcher, the Conservative Party leader, is apparently trying to substitute race for the economy as a major political issue here.

Her move is causing some dismay among moderate members of Parliament in her own party and could backfire against her. The gamble appears to reflect a calculation that a substantial number of Labor Party supporters will desert to a candidate who promises to curb the nonwhite immigrant population in Britain.

Thatcher's campaign opened last week on two fronts. She went on national television Monday to promise four times "the prospect of a clear end to immigration." She went on national television Monday to promise four times "the prospect of a clear end to immigration." She warned that "the British character" which "has done so much for democracy, for law" was being "swamped by people with a different culture."

At the same time, her party's organ, the Conservative Monthly News, asked in a bold headline on its front page, "How Many More Immigrants?"

"Racial peace," the paper asserted. is threatened by "the fear that the queue of further immigrants to come is never-ending."

The number of Asian, African and West Indian immigrants now in Britain is estimated at 1.8 million, about 3 percent of the population. Successive restrictive laws by both Tory and Labor governments have squeezed the yearly inflow to about 40,000, mostly dependents of those already here.

The vast majority of immigrants from former colonies were encouraged to come in the 1950s and early 1960s to work on subways, buses and in textile looms at conditions and pay rates white Britons would not accept. The high unemployment of the last four years has sharpened tensions, however, particularly between immigrants and working-class whites.

Thatcher's use of the race is seen here as an expression of Conservative frustration with the cautious and conventional government of Labor Prime Minister James Callaghan.

Thanks to more than two years of union wage restraint and the flow of North Sea oil, Labor has brought a raging inflation sharply down and has turned the pound around. This has set the stage for a sizable tax cut this spring - it could be the equivalent of twice President Carter's proposed $24 billion, given the relative size of the two economies - designed to expand demand and jobs.

Thatcher has reason to feel that Callaghan has outflanked her on the right over the economy. Fifteen months ago she enjoyed a 19 percentage point lead in one important poll; today that poll shows her trailing by nine percentage points.

She appears to be making a bold bid for Callaghan's most discontended voters, the workers who live in grim, high-rise public housing and march or sympathize with the splinter racist party, the National Front. Thatcher has discribed the Front as an "awful thing." But she pointedly showed her understanding of its followers, observing "they say that at least they [the Front] are talking about some of the problems."

Her chief strategist is Airey Neave, the Tory spokesman for Northern Ireland. He is mounting a quieter, parallel campaign to pry from Callaghan the seven to 10 Ulster Protestant members of Parliament who help keep the minority Labor government in power.

Last week, Neave declared that power sharing - the formula to give Catholics an assured place in any Ulster government - "is no longer practical politics." With this, Neave apparently hopes to take the Protestants' votes from Callaghan.

The Tories' new strategy faces problems. It is very difficult to outflank Callaghan with a hard line on race. As home secretary in 1968, he swiftly repudiated a British pledge and imposed barriers against the immigration of Asians with British passports who were expelled from Kenya. As prime minister, one of his first acts was to fire Alex Lyon, perhaps the government's most persistent battler for racial equality from the Home Office.

In the same way, Protestants do not fault Callaghan for his performance in Ulster, one reason they vote with him. The government has not, like Neave, formally repudiated power sharing but behaves as if it were dead.

Finally, Thatcher risks allenating some of her party's members of Parliament who would be described as "liberals" on race in American terms. They are telling themselves that her moves last week are not part of a thought-out strategy but gut responses to her own instincts.

Tory papers, from The Times to the Daily Express approved her statements with varying degrees of enthusiasm; the Daily Mirror, a Labor paper, and The Guardian, a liberal independent, criticized her.

The Financial Times, a voice of small "c" conservatives ran an editorial headed "No Credit to Mrs. Thatcher." It called her remarks "at best spurious and at worst positively misleading." The paper said Britain's race problem lies in job discrimination and the high rate of black youth unemployment, none of which Thatcher mentioned.

Up to now, the Asian, African and Caribbean immigrants here have been notable for their political inactivity. Fresh outbreaks of racial disorder and a renewal of Thatcher's attacks could change all that and create the non-white political organizations that have absent.

At the very least, however, Thatcher has revived a somewhat dispirited Tory Party. Her evident popularity among rank and file Conservative workers had clearly been strengthened by last week's events.