Four years ago, Republican Thomas H. Kean was elected governor of New Jersey by 1,797 votes -- the narrowest margin in the state's history. If the projections of most polls prove correct, Kean could be reelected on Nov. 5 by the state's biggest margin -- possibly in a 3-to-1 landslide.

In four years, the 50-year-old former real estate agent, history teacher and state legislator has mastered the art of being some things to all people. President Reagan, unions, the head of the state NAACP, teachers and feminists are all on record praising him.

One recent poll showed Kean leading among blacks, the Democrats' most loyal voting bloc, as well as among Jews -- even though his Democratic challenger, Essex County Executive Peter Shapiro, 33, would be the state's first Jewish governor.

With Kean (pronounced Kane) at the top of the ticket, New Jersey voters are expected to give Republicans their second two-term governor in 141 years. The GOP also hopes to take control of the state Assembly (which now is controlled by the Democrats, 44 to 36), and to increase from 12 to as many as 17 the number of Republican majorities on the state's 21 county boards.

To gain such success, Tom Kean, an unimposing and not particularly charismatic moderate, adopted many of Reagan's media techniques to establish a presence that observers say is unprecedented in New Jersey gubernatorial politics.

Kean also borrowed Reagan's message of unbridled optimism about America's potential, which he terms the "hidden strength" of all the nation's past great leaders. He has reached out to black, Hispanic and other minority voters with a message that they should share in the opportunity and economic prosperity.

Meanwhile, he has left behind much of the divisive social agenda many conservatives consider essential.

Kean's record is such an ideological mixture that Democrat Alan J. Karcher, speaker of the Assembly, calls the governor "a Bolshevik Republican."

"The real lesson," said Kean strategist Roger J. Stone Jr., "is that the politics of consensus works better than the politics of polarization . . . . "

"If you're talking about building a party beyond Ronald Reagan," Kean said, "beyond a popular charismatic figure who seems to appeal to all sorts of people, then you've got to have a party that reaches out to all people and all groups. A party which in some cases has written off labor or blacks or Hispanics in some other area is dead wrong."

Kean's record offers few surprises for that of an urban governor. He has tried to lure and retain business and has fought for funds to refurbish and expand the state's roads and bridges, its vital commercial infrastructure.

Like other governors, Kean launched a costly offensive to improve education, raised taxes to avoid a budget deficit and then cut them as the election year approached. He also declared 1985 "The Year of the Environment," in a state where that is a major concern.

At times Kean has used state economic surpluses to reach out to traditionally Democratic groups. Paterson Mayor Frank X. Graves (D) praises Kean for personally delivering a $1 million state-aid check to help the cash-strapped city pay for police and fire protection. Kean also has tried to make majority black Camden a showcase for urban renewal.

Some conservatives fault him for leading an effort against legislation to permit a moment of silence in public schools, and he is pro-choice on abortion. Yet he signed the state's death penalty bill.

State government spending increased 56 percent in the Kean years, much of it in the form of aid to municipalities. His goal was to help lower New Jersey's property taxes, among the highest in the nation.

In trying to attract black votes, Kean says he has appointed a record number of black judges and signed legislation that removed $2 billion in state pension funds from firms that operate in South Africa. But Democrat Shapiro has responded that blacks should be wary of Kean's appeals, noting that the governor also is working hard to elect a Republican Assembly, which would cost black Democratic members their leadership positions.

Establishment of a $3.3 billion highway and bridges trust fund won Kean political points with construction-trades unionists. Similarly, he won passage of a bill creating the highest minimum teacher salary in the nation, $18,500 a year -- to the delight of teachers' unions.

Voter complaints about Kean generally cite local, not national issues.

"I get the feeling that the man really is trying his hardest to do a good job, and I have confidence in him," said financial consultant Daniel Horchler, 30, of Red Bank, who was a Jimmy Carter supporter.

Even on abortion, Kean seems to get the benefit of the doubt. Belleville accountant Mary Lou Thompson, 33 and a Republican, described herself as "conservative" on abortion. She nevertheless supports Kean. "You're not going to have any one candidate who agrees with everything you agree with," she said.

While few think that Kean will win the majority of black votes, some expect him to draw as much as one-fourth to one-third -- an unusually high proportion for a Republican. Several blacks interviewed said they are closer than ever to voting for a Republican.

Like no other New Jersey governor, Kean has used modern communications to enhance his image. He is immensely accessible to reporters. He makes major ceremonies of routine bill signings and gubernatorial proclamations. Democrats complain that he sometimes suggests that measures they initiated were his own. He uses incumbency "not for leadership but for exposure," Karcher said.

Cliff Zukin, pollster for the Eagleton Institute of Politics at Rutgers University, said Kean benefits from being in a state where the governor is the only statewide elected official and thus monopolizes local media coverage.

Moreover, "There is a process of reasoning backwards," Zukin said. "Since the state is doing well, he must be doing a good job."

Since 1973, when Democrat Brendan Byrne won the governor's race by a 2-to-1 margin, New Jersey has become more Republican. In 1978, the Democrats enjoyed a 22-point advantage in voter identification. That margin shrank to 17 points in 1982, and is now a scant 3 points, according to Eagleton Institute polls.

"The state is marvelously independent. It has been going through a period of dealignment over the past 20 years," Zukin said. Registered Democrats outnumber registered Republicans 2 to 1 among the 3.7 million voters. But independents are the largest group.

New Jersey is undergoing an economic transformation that has helped cut unemployment almost in half during Kean's years. Among the states, it ranks third in per capita income and sixth in high-tech industries' growth. Past patterns of young people leaving the state have ended.

Zukin said Republican identification is growing fastest among these younger voters, but the impact is not yet fully felt because most of them still vote infrequently.

For Democrats, the net result of a popular governor and an improving state economy has been pure frustration this year. The fact that Shapiro, who in 10 years has never lost an election, runs closer to Kean on the issues than he does in candidate preference polls elicits grumbling from the Democrat and top aides.

They blame their inability to cut into Kean's popularity on everything from a cynical electorate, to a "Teflon" incumbent, to a news media lulled into complacency, to a vanished voter desire to gamble on something better.

In August, an Eagleton Institute poll found Kean the choice of 68 percent of those interviewed, compared with 19 percent for Shapiro and 13 percent undecided. The most recent poll, taken in mid-October, found the gap virtually unchanged, 67 to 17, with 17 percent undecided.

"This says something about Republicans, but it says more about the power of incumbency," Shapiro lamented, "particularly at a time when the economy's going well and when the worry level is not that high among people."