“We still believe that there was massive and structured fraud in the presidential election,” Mr. Tantowi said. “The Constitutional Court’s ruling has not given us substantive justice, which is the essence of our democracy. There will be a long struggle to fix our system. We will continue to struggle together with the people.”

The judges had been widely expected to reject Mr. Prabowo’s appeal, given that the country’s General Elections Commission and independent election observers had dismissed his claims, as had many political analysts.

The ruling Thursday affirmed the startling rise of Mr. Joko, 53, who was born and raised in a slum area in the city of Surakarta, also known as Solo, in Central Java Province. He grew up to be a carpenter and later a furniture exporter before entering politics in 2005. He was twice elected mayor of his hometown, then governor of Jakarta in 2012, a role in which he gained national attention for his common touch.

Mr. Joko, widely known as Jokowi, will be Indonesia’s seventh president and the first not to have emerged from the country’s political elite or to have been an army general. He has promised to focus on the needs of ordinary people in a country that, while a member of the Group of 20 major economies, has more than 100 million people living on $2 a day or less.

His agenda includes ridding the national bureaucracy of inefficiency and corruption through electronic budgeting, purchasing and audits; increasing infrastructure spending; eliminating energy subsidies that cost tens of billions of dollars annually; and addressing economic inequality.

While Mr. Joko has been widely seen as bringing new excitement to Indonesia’s political scene, which for decades has been ruled by aloof members of the elite, the new president could face formidable obstacles the moment he is sworn in.

The coalition of parties that backed Mr. Prabowo’s campaign will hold 68 percent of the seats in the incoming House of Representatives, which was elected in April and convenes in early October. Mr. Joko’s Indonesian Democratic Party of Struggle came in first with 20 percent of the seats, but other large parties supported Mr. Prabowo in July. Chief among them was the Golkar party, Mr. Suharto’s political vehicle for 32 years, which came in second in the April legislative election.