In what appeared to be a strong backlash against the killing of kidnaped Christian Democratic leader Aldo Moro, his party made heavy gains in local elections scattered across Italy.

A sympathy vote for the ruling party, which had been steadily losing ground in recent elections, was generally expected but the results surpassed all predictions.

The Communist Party, which is allied with the Christian Democrats in parliament, largely held its own.

Christian Democratic gains seemed to be primarily at the expense of a host of small Parties, except for the Socialists, who did well.

The parties at the two extremes, the leftist opposition to the Communists and the neofascists, were the biggest losers.

With 90 percent of the vote counted in towns of more than 5,000 inhabitants the Christian Democrats got 42 percent, compared to 37 percent in the last strictly comparable local elections in 1972 and 39 percent nation-wide in the parliamentary elections of 1976.

The Communists got 26.6 percent, compared to 25.8 percent in the same localities in 1972 and 35.5 percent nationally in 1976. The Socialists got 13.2 percent as against 13.5 percent locally in 1972 and 9.2 nationally in 1976.

The parties in power traditionally lose ground in local elections. The Christian Democratic Party's strong showing today was widely interpreted both as a sympathy vote and as a message against political terrorism.

Remo Gaspari, a deputy secretary of the Christian Demorcratic Party, called the vote, "an act of solidarity toward our party and a great demonstration of the maturity of the Italian people in regard to the terroists."

He took care to point out that the communists had also improved their percentage over the 1972 local elections.

Ugo Pecchioli, a Communist Party spokesman, expressed some unhappiness with the results. He said the party had not done as well as it had hoped not because people associate it with terrorists, who call themselves communists, but because a number of voters are dissatisfied that the regular Communists are no longer in the opposition.

Another Christian Democratic spokesman said that nobody in the party wants to exploit its good showing to call general elections since they regard the vote as an answer to terrorism rather than something to take political advantage of.

Both sides said the results would not affect the two parties current alliance in parliament and their policies of furthering the "historic compromise" between the Christian Democrats and Communists.

The elections, involving about 4 million voters, or 10 percent of the electorate, were for town council members in about 800 small and medium-sized towns and two Provincial councils. No major towns voted in the two-day elections for local governing bodies yesterday and Sunday. The turnout was nearly 90 percent. In the largest town voting, Novarar (pop. 102,000) near terrorist-ridden Turin, the Christian Democrats polled 38.1 percent, up 3.5 percent from the 1972 municipal elections and 5.1 percentfrom the national elections of 1976. The Communists got 30.6 percent, 4.4 percent more than 1972, but 5 percent less than 1976.

In the region of Trent, where the doctrine of the Red Brigades, the group that kidnaped Moro, was first elaborated by the group's founder, Renato Curcio, when he was a sociology student at the local university, town after town gave the Christian Democrats even better results than the national average. The Communists lagged there about 1 percentage point behind their local showing in the 1972 local elections.

In Bologna, the major city with the longest establidhed Communist administration, the Red Brigades today claimed responsibility for severely wounding the personnel manager of an automobile plant. Antonio Mazzotti, 48, was in serious condition after being hit by bullets in the stomach and chest as well as the traditional terroist target, the legs.

The Brigades may have intended to kill him. An anonymous caller to the Bologna office of the Italian news agency said, "We have executed Mazzotti . . . a servant of the state."