His rival, Raila Odinga, and others had alleged there had been massive fraud.
But in a scathing ruling, the judges said some of the petitioners had falsified evidence.
Mr Ruto garnered 50.5% of the vote in the closely fought election against 48.8% for Mr Odinga.
The 55-year-old will be sworn in as the country’s fifth president next week.
Following the ruling, Mr Ruto said he would extend a hand of friendship to his political opponents, and praised the judiciary and the electoral commission for upholding the “will of the people”.
Despite being the current deputy president, Mr Ruto was not backed by the outgoing President, Uhuru Kenyatta, who instead campaigned for his former rival, Mr Odinga.
But Mr Ruto said he would be speaking to both men shortly and promised that his government would look after them in retirement.
“We are not enemies, we are Kenyans. Let us unite to make Kenya a nation of which everyone shall be proud to call home,” he said.
In a recorded message, Mr Kenyatta congratulated the leaders who had been elected in the general elections but didn’t mention Mr Ruto by name.
The president, who has clashed with the judiciary several times in the past, expressed his misgivings about the Supreme Court ruling, but said he would abide by it.
“The process of handing over is in progress… it is my intention to oversee a smooth transition to the next administration,” Mr Kenyatta said.
The eight petitions challenging the elections were all dismissed.
The court found some were based on forged documents and “sensational information”, Chief Justice Martha Koome said in a unanimous decision on behalf of the seven judges.
No credible evidence that the electronic voting transmission system had been tampered with by a supposed “middle man” was presented, she said.
Ms Koome also said that Mr Ruto had met the constitutional threshold of garnering 50%+1 of votes cast.
The ruling ends a protracted election dispute that started after polls closed last month, leading to widespread uncertainty across the country, in case of a repeat of previous outbreaks of election violence.
Mr Odinga’s team had used the dissent of four of the seven electoral commissioners – who disowned the poll results because they had fallen out with the chairman – to bolster his case.
But while noting the “dysfunction” of the commission in managing its internal affairs, the court said it was not convinced that the claims of the chairman running a one-man show was enough to undermine the election.
“Are we to nullify the outcome of an election on the basis of a last-minute boardroom rupture whose details remain scanty?” the judges asked.
The judges also reprimanded lawyers and petitioners who filed falsified documents in court – a rebuke meant to deter spurious petitions in the future.
The ruling prompted celebrations in Mr Ruto’s home area of the Rift Valley and parts of the Central Province where his running mate hails from.
In Mr Odinga’s stronghold of Kisumu, there was a subdued atmosphere. Streets were deserted and some businesses closed for the day.
Kenyans will now be watching the political repercussions of Mr Ruto’s win for the main players.
Mr Odinga has now lost five elections. At 77 it’s hard to see how he will run again or even if he will remain active in opposition politics, though his statement lambasting Monday’s ruling says he will continue with the “struggle for transparency, accountability and democracy”.
As for outgoing President Kenyatta, who worked hard to prevent his deputy from succeeding him, it will be interesting to see if their relationship remains strained.
Most importantly, Kenya has shown that it can resolve elections disputes without resorting to the violence we have seen in the past.