Michelle Obama praised the diverse graduates of the city's oldest public institution of higher learning and took a mild swipe at Donald Trump as she delivered the last commencement address of her tenure as U.S. first lady on Friday.

"I really want you all to know that there is a reason why, of all of the colleges and universities in this country, I chose this particular school in this particular city for this special moment," Obama told the graduates of the City College of New York.

Noting that students at the 169-year-old college come from 150 countries and speak more than 100 languages, she said, "You represent just about every possible background - every color and culture, every faith and walk of life."

Obama, the wife of Democratic President Barack Obama, told the graduates that "with your glorious diversity, with your remarkable accomplishments and your deep commitment to your communities, you all embody the very purpose of this school's founding."

She made a thinly veiled reference to Trump, the presumptive Republican presidential nominee, by saying "some folks" don't value the diversity that City College embodies.

"They seem to view our diversity as a threat to be contained rather than as a resource to be tapped," Obama said. "They tell us to be afraid of those who are different, to be suspicious of those with whom we disagree.

"They act as if name-calling is an acceptable substitute for thoughtful debate, as if anger and intolerance should be our default state rather than the optimism and openness that have always been the engine of our progress."

Trump has promised to build a wall between the United States and Mexico, proposed banning Muslims from entering the U.S. and said it's risky to take in Syrian refugees because terrorists could be among them.

Obama added that "here in America, we don't give in to our fears. We don't build up walls to keep people out because we know that our greatness has always depended on contributions from people who were born elsewhere but sought out this country and made it their home."

City College, founded as the Free Academy of the City of New York in 1847, gained a reputation as the poor man's Harvard in the 1930s, when it educated a generation of Jewish intellectuals who were shut out of elite private colleges.

City College alumni include 10 Nobel Prize winners and many renowned authors, scientists, business leaders and artists.

More than 40 percent of City College's current students are first-generation college students and half are from low-income households.

More than 3,000 graduates and their families cheered the first lady's speech under drizzly skies at the City College campus in Harlem.

Class salutatorian Orruba Almansouri exemplified one of the issues Obama has championed, the education of girls. Almansouri, a Yemeni immigrant, said it was only after daily debates with her father that she was allowed to attend college, which no girl in her family had done before.

"I fought to be allowed to pursue an education, for the right to be here," Almansouri said.

She said that following her example, several of her female cousins are now pursuing higher education.