The Messenger of Allah ﷺ said, "Whoever enters a horse in a race between two other horses without being certain that it will win, this is not gambling. But whoever enters a horse in a race between two other horses while being certain that it will win, this is gambling."
حدثنا أبو بكر بن أبي شيبة ومحمد بن يحيى قالا حدثنا يزيد بن هارون أنبأنا سفيان بن حسين عن الزهري عن سعيد بن المسيب
قال رسول الله ﷺ من أدخل فرسا بين فرسين وهو لا يأمن أن يسبق فليس بقمار ومن أدخل فرسا بين فرسين وهو يأمن أن يسبق فهو قمار
[Its chain of transmission is daif] Abu Dawud narrated it in jihad, chapter on one who legalizes (a divorced woman's remarriage), hadith 2579, from the hadith of Sufyan, through this same chain, Sufyan bin Husayn from Zuhri is daif, as stated in Tahdheeb and elsewhere, and this is a specified criticism, which takes precedence over a general endorsement. Indeed, he is reliable in narrations other than from Zuhri, as is established in the principles of the science. Saeed bin Bashir, who is daif according to Taqreeb, corroborated him, from Zuhri, through this chain, Abu Dawud, hadith 2580.