Abu Hurairah reported,

The Messenger of Allah ﷺ said, "There were two women, each with her son. A wolf came and carried off the son of one of them.She said to her companion, 'It was your son he took.'The other replied, 'No, it was your son he took.'So they brought their dispute before Dawud عليه السلام, who ruled that the child belonged to the elder woman.Then they went out to Sulayman bin Dawud, peace be upon them both, and informed him of the matter.He said, 'Bring me a knife so I may cut him in half between them.'The younger woman cried out, 'Do not do it, may Allah have mercy on you. He is her son.'So he ruled that the child belonged to the younger woman."

Azami 6723

Sahih

عن أبي هريرة

أن رسول الله ﷺ قال: كانت امرأتان معهما ابناهما، جاء الذئب فذهب بابن إحداهما، فقالت لصاحبتها: إنما ذهب بابنك، وقالت الأخرى: إنما ذهب بابنك، فتحاكما إلى داود عليه السلام، فقضى به للكبرى، فخرجتا على سليمان بن داود عليهما السلام، فأخبرتاه، فقال: ائتوني بالسكين أشقه بينهما، فقالت الصغرى: لا تفعل يرحمك الله هو ابنها، فقضى به للصغرى.

الأعظمي 6723صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Judgeship
Chapter
Conduct of the judge
Section
Overturning the ruling of the judge when the truth appears to contradict it
Numbering
Jami al-Kamil 6723 (2nd edition)
Azami 6723