Sayyiduna Abu Hurayrah (may Allah be pleased with him) said that the Prophet (peace and blessings be upon him) said: "Whoever enters a horse between two horses while he is fully free of any fear of its losing, that is gambling; and whoever enters a horse between two horses while he is not free of fear of its losing, that is not gambling."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السبق والرمي / 19770