He said Mr Trump’s attempt to discredit a poll before it has even taken place was “unprecedented” for a US presidential candidate.
Also “unprecedented”, said Mr Obama, was the Republican candidate’s “flattery” of Russia’s president.
Mr Trump is facing sinking poll numbers and accusations of sexual assault.
The businessman-turned-politician has claimed the 8 November election will be “absolutely rigged” for Democratic candidate Hillary Clinton.
But in a White House Rose Garden news conference on Tuesday alongside visiting Italian Prime Minister Matteo Renzi, Mr Obama said his assertions were “based on no facts”.
“I’d advise Mr Trump to stop whining and try to make his case to get votes,” Mr Obama said.
“By the way,” he added, “doesn’t really show the kind of leadership and toughness that you want out of a president, if you start whining before the game’s even over.
“If whenever things are going badly for you and you lose you start blaming somebody else, then you don’t have what it takes to be in this job.”
Mr Obama also addressed the Republican candidate’s admiring remarks about Vladimir Putin.
“Mr Trump’s continued flattery of Mr Putin and the degree to which he appears to model much of his policies and approach to politics on Mr Putin is unprecedented,” he said.
His broadside comes a day after Mr Trump said he would consider visiting Russia before taking office, if elected.
He told a talk-radio host: “If I win on November 8, I could see myself meeting with Putin and meeting with Russia prior to the start of the administration.”