Tokyo — Kakuei Tanaka, the ''shadow shogun'' of Japan, has won reelection by an enormous majority in his snowbound constituency of Niigata in a general election in which political morality was the chief national issue.
But nationwide, Prime Minister Yasuhiro Nakasone and his ruling Liberal Democrats are facing a tough challenge from the Socialists and other opposition parties.
In Mr. Tanaka's district, farmers and housewives in snow boots and down jackets braved driving snow to cast their ballots, hardly bothering to close the curtains of their voting booths when they marked the candidate of their choice. Mr. Tanaka's majority of some 220,000 votes was the highest he has ever obtained , higher even than the 189,000 he obtained when prime minister 11 years ago.
The gruff former premier has thus safeguarded his continuing influence over the Nakasone Cabinet despite his conviction on Oct. 12 of having accepted a 500 -million-yen bribe from the Lockheed Aircraft Corporation while prime minister in the early 1970s. The Liberal Democrats are expected to barely retain their majority in the House of Representatives, the lower house of the Japanese Diet (parliament).
But final results must await vote-counting in Tokyo and other metropolitan areas today.
Mr. Nakasone, who emphasized his personal ties with President Reagan during the election campaign, is expected to be renamed prime minister when the new Diet convenes at the end of this month. It seems unlikely that he will be given the convincing mandate he sought for a foreign policy emphasizing close economic and defense ties with the United States.
The much-publicized challenge to Tanaka by writer Akiyuki Nosaka has failed, but Mr. Nosaka says he is determined to remain in Niigata and to chip away year by year at Tanaka's formidable vote-getting machine.
Mr. Nosaka braved snowdrifts to tour the remote villages of a desolate area called Japan's Tibet in order to take his campaign to the farmers and construction workers that form the core of Tanaka's support.
An earnest if somewhat expressionless figure who turned down most of the offers of campaign touring made to him by a flock of actors, singers, and entertainers, Nosaka told voters to their face that they had become too dependent on Tanaka's political power.
''Mr. Tanaka has done a lot for the third district. I admit that,'' Nosaka would say in his flat monotone. ''He has built splendid roads and bridges and tunnels throughout this district. But what are you going to do now that most of these public works have been finished?''
''That's all very well for you to say,'' one young construction worker replied during one of Nosaka's appearances in a village hall. ''But without roads and tunnels, every winter we are completely cut off from the outside world. What alternative are you proposing?''
''I have no panacea, no ready-made solution,'' Nosaka rejoined. ''I'm just suggesting this is something every voter must think about.''
Nosaka's willingness to beard the Tanaka machine in its own den clearly intrigued many voters. But his final total of some 28,000 votes came far short of the 50,000 he had been talking about as a campaign goal.
Nevertheless his challenge forced Tanaka, who had originally intended to make only occasional forays into Niigata from his palatial mansion in Tokyo, to spend the entire two-week campaign period in his constituency, making three hour-long speeches a day and visiting every single village and town in the district.
''This election is a kind of purification rite,'' Tanaka's campaign strategists told journalists. In other words, the stain of the bribery conviction would be washed away by the votes of Tanaka's own constituents.
Nationwide, however, the Tanaka conviction has been a minus factor for the Liberal Democrats. In his own constituency of Gumma, Prime Minister Nakasone lost a popularity contest with former Prime Minister Takeo Fukuda. Both were reelected but Mr. Fukuda's votes exceeded those of Nakasone by over 10,000. Fukuda, an elder statesman of the Liberal Democrats, has been one of Tanaka's severest critics.