Let's divide the horses into 5 groups (A to E) of 5.
1. Race the five groups. Let's label the horses by the Group (A to F) and place (1 to 5).
The 4th and 5th in each group can automatically be elimated (since they are definitely not top 3).
That leaves you with 15 horses (A1-3, B1-3 etc).
2. Race the winners of the five groups (A1, B1, C1, D1 and E1). Again, bottom 2 (Let's say D and E) can be eliminated. Also, their entire group can be eliminated since none of them can be top 3). The 2nd and 3rd of the group coming in 3rd (let's say C) can also be eliminated. B3 can also be eliminated since it is definitely slower than A1, B1 and B2. You are therefore left with 6 horses (A1-3, B1-2 and C1).
3. A1 is definitely the fastest horse of the 25. So just race A2, A3, B2, and C1 and take the top 2.
Total = 7 races.