Your assumption that a country can do better so long as it has "good leadership" is false, the relative failures and success's of Botswana and Ghana are mostly structural.
Botswana's "success" is inflated and mostly untrue. It's a country with a small population yet comparatively rich in mineral resources. This leads to high growth in some sectors of the economy yet inequality and poverty remains the norm and as late as 2001 the life expectancy of the country was close to 40 years!
Also the idea that Botswana is democratic and clean is completely laughable considering that the ruling party rigs the electoral system to ensure that it always has an absolute majority despite receiving less than 50 percent of the vote.
The economic challenges that Ghana faces are much greater in comparison to Botswana. Not only did it have a much larger population but initially after independence it's economy was completely based off cocoa farming, while things initially worked out fine after independence the problem came with the constant fluctuations in the agricultural market which will always hurt your economy if it's you main producer. Attempts to industrialized failed because they relied on foreign capital, those bastards only wanted to invest money in such a way that benefited their business to the detriment of industrial development. The government took out loans but this simply put them in even more debt, which of course lead to even more economic and political instability.
High mineral resources don't generally lead to prosperity. They lead to Dutch Disease and gross corruption unless governance is sufficiently good; in Africa, Botswana is the best example of such. I admit, its Gini coefficient is high, but it had one of the highest rates of growth in the world for many years, and the reason for its low life expectancy (as well as a partial explanation for its slowing growth) is the country's horrible AIDS problem, about which more could have of course been done, but almost no African country managed it well (Uganda is the only one I can think of).
As for its democracy, while the vote totals are concerning, the one source I found that look like it would support your view didn't load. Still, the rule of law is more important than electoral competition for the kind of statistics that go into HDI, and Botswana's democracy is still miles better than most African political systems, particularly before the turn of the century.
A lage population is usually not a handicap, i is, in fact, one of the main drivers for growth. Ghanaian agriculture could have been managed successfully, but the industry was used as a tax and patronage source to set up unrealistic industrial concerns and prestige projects.
The Botswanan economy is primarily based on mineral exports, but it's not nearly as hollow in other aspects as seems to have been implied. The country has been diversifying pretty fast and seemingly successfully, especially into finance and tourism.
My main point, though, was that Botswana-level governance was about the best that could be reasonably expected in African conditions.