Trudeau told a crowd of thousands at the Reviving the Islamic Spirit conference in Toronto that his critics attempted to tap into "fears and prejudices" that sap the acceptance of others.
"It is short-sighted to pit groups of Canadians against one another. It may make some feel good for a little while, or even work politically in the short term, but it is no way to build a country," Trudeau said in a keynote address.
"It is not who we are."
Trudeau was criticized earlier this month by some Jewish groups and media outlets for agreeing to address the conference because of allegations of a link between one of its sponsors, IRFAN-Canada, and the militant group Hamas.
IRFAN pulled out of the conference a few days after all the publicity generated by Trudeau's planned appearance.
The group's charitable status was revoked last year by the Canada Revenue Agency, which alleges the group used deceptive fundraising to send almost $15-million in donations to organizations with ties to Hamas, which governs the Gaza Strip.
IRFAN denies any wrongdoing and says it is challenging the ruling. A lawyer for the group has called the claims misleading, saying the non-profit sent medical supplies and money to people in need through local certified charities.
Trudeau reached back into Canadian history during his speech, which centred on tolerance of diversity.
He pointed to former prime minister Wilfrid Laurier as he struggled as a young man to bridge the fierce divide between English and French-Canadians. Trudeau spoke of the role Canada's institutions, such as its constitutional protections, play in guaranteeing freedom for every group.
But the underlying basis of the country's diversity is rooted in its middle class, Trudeau said, touching on a theme of his leadership campaign.
"This broad, diverse middle class is Canada's centre of gravity," he said.
"Good people. People with common hopes and common challenges, coming together to find common ground."
Trudeau's attendance follows in the footsteps of several other politicians who have addressed the conference, now in its 11th year.
The late NDP leader Jack Layton and federal cabinet minister Julian Fantino, then Toronto's police chief, have also attended.
In honour of last year's conference, Prime Minister Stephen Harper sent a congratulatory statement and issued certificates to each of the event's speakers.