With Mr. Johnson bedridden while Dr. Varadkar counsels patients, the comparisons between these neighbors are as inevitable as they are invidious.

Britain has 13 times the population as Ireland and is far more densely populated, with a capital, London, that has nearly twice as many people as the entire Irish Republic. Its gateway airport, Heathrow, handles 75 million international passengers a year, compared with 31 million for Dublin.

“Some of the difference may be serendipity,” said Dr. Patricia Kearney, an expert in epidemiology at the University College Cork. “We have a relatively small population, and the way we live outside the cities is far less dense than in the U.K. But there was still really decisive action by our political leaders.”

Dr. Varadkar’s performance has not completely escaped criticism. Some people clucked over his decision to keep his annual St. Patrick’s Day date with President Trump in Washington during the early days of the outbreak. While there, he called a dramatic news conference at Blair House, opposite the White House, to announce he was closing Irish schools and banning large gatherings.

Later, the prime minister, or Taoiseach, as he is known in Ireland, was criticized for saying that people might prefer to lose their jobs because they would qualify for a weekly pandemic unemployment payment of 350 euros ($380). That played into a familiar critique that Dr. Varadkar, the son of an Indian-born doctor and an Irish nurse, has little empathy for those in economic hardship.