The answer to this is really very close to Ted Bunn's answer to this question, but I think there may be one additional point
.... a disk the most stable configuration
Maybe it could be thought of as the 'most stable configuration', but I think it should rather be thought of as the natural state that accreting matter will form for the following reason....
Gravity will tend to pull all the matter together and the 'most stable' form, where the most gravitational potential energy would be released, would be if all the matter collapsed to the smallest volume it could to, for example, form a star.
If the matter before it accreted was all stationary with no velocity and, crucially, no angular momentum then it could all collapse into a spherical shape.
In real life, however the matter that collapses together has some angular momentum about its centre of mass. This means that the matter can collapse together in all directions except in plane of the net angular momentum
One way to think about it is that angular momentum is a sum of all the individual contributions of $m_i v_i r_i$ of each body $i$, where $m_i$ is the mass, $v_i$ the velocity and $r_i$ is the distance from the body to the net axis of rotation, which passes through the centre of mass of the system. The $r_i$ distances cannot be reduced to close to zero for all particles as the angular momentum would not be conserved. On the other hand the distances of all the particles or bodies perpendicular to the plane of rotation can be reduced to zero or close to zero to release the maximum gravitational potential energy.
Finally, in one sense you are correct that the disk is the most stable form - because it is more stable than, for example, a diffused spherical cloud of bodies and particles. If you consider a spherical rotating group of bodies or particles then the bodies at the 'poles' would attract each other and collapse to the centre, but the material at the equator would perhaps collapse in a bit, but angular momentum would prevent it reaching the centre of mass - this would result in formation of a more stable disk.