It really depends on your criteria - Buchanan, for example, is widely considered the worst PotUS of all time, but did he really have any ability to stop the march towards secession? It doesn't make him a good president by even the biggest stretch imaginable, but if you think the march towards the Civil War was coming no matter what, that might be enough to keep him from the bottom. The truly great ones rise to the challenge. Conversely, the truly awful ones create problems that can last generations - something Wilson and Andrew Johnson both did - and it looks like Dubya and Trump have likely done as well.
I rank them in a loose set of criteria....
Rose to monumental challenges.
Made the country, maybe the world a better place in some lasting way, especially if they fixed issues before becoming too big. Only the lack of a crisis might keep them from the top, and thankfully there wasn't one. Living through a crisis sucks.
Didn't mess things up - not bad, but never given the opportunity to prove themselves as anything potentially great.
Unable to rise to the occasion when needed.
Left the country a worse place than they found it, as a direct result of their policies. I personally rank burning the place down when it was fine beforehand as being worse than being unable to put out a pre-existing fire.