I will share these points about this topic:
1- The number of hadiths that we have in our Shia sources about the Imam marrying and divorcing a lot is 6 hadiths. Three of these hadiths are the main hadiths that claim he divorced a lot.
2- In the hadith narrated by Kafi, there are two Waqifis in the chain. Even though they are generally reliable, but given the fact that they are Waqifis weakens the hadith to an extent. Some scholars don’t even accept the hadith of a Waqifi, so according to their standard the narration is weak. The other narration in Kafi is weak from a sanad perspective since there is an anonymous narrator in the chain.
3- So we only have one Sahih hadith from a sanad perspective, and that’s the hadith of Barqi.
4- We have Sahih many hadiths that indicate the Imam is infallible and doesn’t do anything inappropriate. We cannot put all these hadiths to the side due to one sahih hadith claiming the Imam was a habitual divorcee.
5- Assuming the hadith sahih and that there is a background before it, here’s what it could be:
One: Imam Hassan (a) wanted to form bonds with various tribes to save the Shis from the Umayyads. The Umayyads were very powerful, and in that tribal society, one way to gain supporters and form an alliance was to marry from different tribes. The Imam had a noble purpose in marrying many women.
Two: Given that he was the first grandson to the Prophet (s), many fathers would approach him and ask him to marry their daughters so they can have the honor of being connected to the Prophet (s). The Imam didn’t want to turn them down. But they knew he was going to divorce them because practically he couldn’t live with all those women.
There could also be other reasons.
So maybe there was a basis for it, then the enemies of the Ahlulbayt (a) used it to exaggerate and slander the Imam.