KRYVYI RIH, Ukraine — As a university student in Kryvyi Rih, a gritty industrial city in eastern Ukraine, the comedian who is now the strong favorite to win Ukraine’s presidential election showed an early grasp of what it takes to succeed when politics merge with entertainment: a flair for grabbing attention and scripting the narrative without getting tripped up by details.

Volodomyr Zelensky, the 41-year-old comedian and political novice whose runaway popularity has stunned Ukraine’s establishment, was so adept at gauging and shaping his classmates’ mood, recalled his former constitutional law professor, Ivan Kopaihora, that he romped to victory in a mock presidential election held as part of his university coursework.

Mr. Zelensky, a nonpracticing Jew, called his campus party “Clean Ukraine,” foreshadowing what, more than two decades later, would be the main theme of his current campaign to defeat Ukraine’s corruption-tainted president, Petro O. Poroshenko, in Sunday’s second and decisive round of voting.