Three persons were killed and five wounded by a car bomb in the Sicilian city of Trapani today in an attack blamed by officials on the Mafia. One of the wounded, a controversial judge investigating organized crime, was the target of the attack.

It was the first attempted assassination of an Italian official by the Mafia since the top investigating magistrate of Palermo was murdered in a July 1983 bombing. It comes seven months after a major crackdown against the Mafia began in Palermo.

The blast, which almost demolished the armor-plated Fiat in which the magistrate was riding, wounded four of his police bodyguards, two seriously, and his driver. It killed a 30-year-old woman and her six-year-old twin boys. Several buildings were heavily damaged.

The judge, Carlo Palermo, 37, was slightly injured. He had been transferred only recently to Sicily from Trento, where he had headed an investigation into a massive international drugs and arms smuggling ring that he believed had Mafia links.

Only two weeks ago he had issued arrest warrants for five Trapani businessmen accused of corrupting local officials. According to judicial sources, he also was investigating illegal export of capital and other Mafia activities.

"This is clearly a Mafia operation, and not only because of where it occurred," Italian Interior Minister Oscar Luigi Scalfaro said of the explosion. Police and investigators from Palermo including the new Italian high commissioner for anti-Mafia activities, Prefect Riccardo Bocci, flew to Trapani this morning.

Police and judicial sources in Rome and Palermo said the latest Mafia assassination attempt in Trapani (another young judge, Giangiacomo Ciaccio Montalto, was killed there in January 1983) was an indication that investigators looking into the economic ties between organized crime and local politicians were getting too close for comfort.

Corruption is a problem in many Italian cities but in western Sicily, where the Mafia has long-standing roots, it is endemic and has become worse as the Mafia's need to launder the enormous profits of narcotics smuggling has increased in recent years.

Last week in Palermo, investigators charged four former mayors and 12 other officials with corruption, embezzlement and fraud stemming from improper management of huge subcontracts for city lighting and street and sewer maintenance. A fifth former mayor, who supplied evidence for those accusations, is also in jail on charges of accepting kickbacks.

Subcontracts for public construction or services have been used by the Mafia for reinvesting or laundering their drug proceeds, according to investigators.

Hospitalized in Trapani, Judge Palermo told Italian television reporters that today's attack would not prevent him from continuing his work.

A controversial magistrate who faces disciplinary sanctions for an alleged abuse of office stemming from the arrest of a defense lawyer in Venice last year, he also recently became embroiled in a dispute with Socialist Prime Minister Bettino Craxi when he charged members of the Socialist party were implicated in the arms and drug smuggling investigation.

After those problems developed Palermo asked to be transferred to Rome and, when that proved impossible, to Trapani. "I knew what I was getting into," he said.