The 20-year-old Briton earned the right to share Court One with the Swiss, a player whom Clarke admitted he grew up trying to copy, after beating American qualifier Noah Rubin in the first round.
Clarke was outclassed in the first set and, although he took Federer to a tie-break in the second, the eight-time SW19 champion closed out a 6-1 7-6 (3) 6-2 victory in one hour and 36 minutes.
Clarke had spoken of his desire to follow in the footsteps of 15-year-old Cori Gauff, who stunned Venus Williams in round one, and cause a shock against Federer following his maiden main draw grand-slam victory on Tuesday.
He will have taken hope from the fact Federer, who is 17 years older than him, started slowly and dropped a set for only the second time in a first-round match in his last 17 Wimbledon appearances before comfortably beating Lloyd Harris.
However, Federer was not going to make the same mistake twice and breezed into a 3-0 lead, yet Clarke did briefly respond.
He held serve and hit back to take two break points in the next, but that fired Federer up and he won the game before reeling off the next two to claim the opening set.
Clarke refused to let his head drop and responded in confident fashion with the crowd behind him in the second set, which went with serve to the tie-break, and Federer used all his experience to win it.
The end was near when Federer took a 3-0 advantage in the third and, although Clarke held serve a couple more times, the 20-time grand-slam champion eased to victory.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies