They court him over coffee and drop by when they are in town. They dangle invitations for golf and enlist friends to put in a good word.

In an election year when partisanship has burned white hot and the economy has sputtered, two presidential candidates who agree on very little, Mitt Romney and Barack Obama, have reached a rare consensus: they are both determined to score the endorsement of Mayor Michael R. Bloomberg of New York, whose name is all but synonymous with Wall Street clout and nonpartisan politics.

Now, their pursuit of the billionaire mayor is headed into overdrive, with both campaigns making the kind of conspicuous ring-kissing gestures that are reserved for their most sought-after political allies, even though the candidates publicly disagree with the mayor on a range of issues.

On Tuesday, Mr. Romney showed up at the mayor’s philanthropic foundation on the Upper East Side of Manhattan for a secret breakfast meeting. Over coffee and juice, Mr. Romney made clear that he was there to pick the mayor’s brain. “Tell me what’s on your mind,” he said, according to aides who were briefed on the 30-minute discussion, which touched on immigration, gun control and education policy.