The leader of the anti-establishment Five Star Movement party made the decision after seeing a photo of the candidate, Maurizio Pascucci, with a nephew of late mafia boss Bernardo Provenzano.
Di Maio said "the State must be careful not to ever get close to, not even in its image, those people".
Di Maio's visit was set up to support Pascucci's bid for office.
Bernardo Provenzano, who died in 2016 in prison from bladder cancer, was suspected of having been the head of the Corleonesi, a mafia faction that originated in the town of Corleone, and de facto capo di tutti i capi (boss of all bosses) of the entire Sicilian Mafia until his arrest in 2006.
Parliamentary anti-mafia commission chair Nicola Morra of the Five Star movement said "I can only fully support Luigi Di Maio's decision”.
"His words show how the Movement has as its priority in the fight against the mafia and the support for its innocent victims.
"We cannot accept any let-up or ambiguity... I repeat with Luigi Di Maio that we absolutely do not want the votes of Mafiosi," Morra said.
Pascucci, who moved from his native Tuscany to Corleone four years ago, defended his position, saying that relatives of convicted Mafiosi "who take their distance" shouldn't be excluded from the community for life.
Pascucci’s bid for office went ahead.
Counting of the ballots in Corleone continues, with candidate Nicolò Nicolos (who served as mayor of Corleone from 2002 to 2007) currently in the lead, followed by Maurizio Pascucci of the Five Star Movement and centre-left candidate Salvatore Antonio Saporito of Viviamo.