The correct option is
B 7
We need the first 5 races to ensure that each of the 25 horses completes a race once.
We are going to call these five races as preliminary races.
From these 5 preliminary races, we get 5 winners.
The sixth race will be a race among these horses, which are winners of the preliminary races. The winner of the sixth race is clearly the fastest horse. This way we have identified the fastest horse (horse A in the figure).
We need to identify the second and the third best horses. This is where the real trick in this problem lies.
There are five horses which are in contention for the second and the third best positions. These five horses are the following: The horses which finished second and third in the sixth race (the race of the best horses, horses B and C in the figure), the horses which finished second and third in the preliminary race in which the fastest horse finished best (horses F and H in the figure), and the horse which finished second in the preliminary race in which the horse (horse G in the figure), which came second in the sixth race, finished first.
These five horses run the seventh race which will decide the second and the third best horses.