Three men were brought to Ali while he was in Yemen. They had all had relations with the same woman during a single period of purity. He asked two of them, "Do you both acknowledge this child as belonging to him?" They said, "No." Then he asked another two, "Do you both acknowledge this child as belonging to him?" They said, "No." So he drew lots between them and assigned the child to the one whose name came up in the draw, and ordered him to pay two-thirds of the blood-money to the other two.This was mentioned to the Prophet ﷺ, and he laughed until his back teeth showed.
أخبرنا أبو عاصم خشيش بن أصرم قال أنبأنا عبد الرزاق قال أنبأنا الثوري عن صالح الهمداني عن الشعبي عن عبد خير
أتي علي رضي الله عنه بثلاثة وهو باليمن وقعوا على امرأة في طهر واحد فسأل اثنين أتقران لهذا بالولد قالا لا ثم سأل اثنين أتقران لهذا بالولد قالا لا فأقرع بينهم فألحق الولد بالذي صارت عليه القرعة وجعل عليه ثلثي الدية فذكر ذلك للنبي ﷺ فضحك حتى بدت نواجذه
Its chain is daif. Abu Dawud narrated it in the chapter "One who said the lot should be drawn when they dispute over the child," in Talaq, no. 2270, from Khushaysh, with this chain, and it is also in al-Kubra, no. 5682. Sufyan Thawri used an ambiguous form of transmission (an'ana), and the hadith has daif supporting narrations.