Because he wanted to prepare the Pandavas; he wanted them to achieve victory rightly and uphold the principles of Dharma. If they had not been prepared and taken over the kingdom prematurely, there was a risk that they themselves might have been another tyrant. Therefore, he allowed the one who was destined to become a great leader to fail—repeatedly. This is how a true leader is shaped. A leader who rises without struggle will never fight for you or work for you, as he is likely to fail and take you down with him. Power that cones without struggle often corrupts the man who receives it. Hence we see in ancient times that even the prince who was going to inherit the power had to go through the gurukula to become rightly deserving.
But the Pandavas were chosen for something much greater, to govern not just a kingdom but to establish a nation governed by dharma, hence the sever training through the school of nature. In fact had Shakuni not cheated them so badly they would have never waged war against the Dhritrastrians leading to a permanent fissure in India between two centres of power, one representing dharma with the Pandavas at the centre and the other representing adharma with Duryodhan and Shakuni at the helm of affairs. Shakuni’s deceit gave the occasion and eventually the entire refusal of Duryodhan to the peace proposal by Sri Krishna became the excuse for the great Mahabharata war. As a result, through and despite the bloodshed, there was eventually one indivisible Bharatvarsha governed by Yudhidthira who was an embodiment of dharma.
Affectionately,
Alok Da