John McCain is trying to convince Mayor Bloomberg to support Mitt Romney’s bid for president.

McCain — the GOP Arizona senator who lost to President Obama in 2008 — visited the mayor at City Hall yesterday to talk up the likely Republican nominee.

“I just came in to pay my respects to the mayor. He and I are old friends from many years back,” McCain told The Post as he left City Hall. “I told him that I just spent last weekend with Romney and I thought that Romney was on message . . . and tried to convince the mayor that we’ve got a winning campaign.”

Bloomberg spokesman Stu Loeser said, “Any day Sen. McCain has time to stop in at City Hall is a great day for us.”