Assume that the fifty-move rule does not require a player to claim a draw. Instead, the game is automatically declared a draw if no pawns have been moved and no pieces have been captured in the last 50 moves.
Hence, we don't need to maintain the entire game history to detect threefold repetitions. We only need to maintain a history of the last 100 positions. Out of these 100 positions, half of them are white-to-play and the other half are black-to-play. Hence, only 50 of these 100 positions could possibly be the same as the current position.
Now, out of these 50 candidate positions if each position is repeated twice then we only have 25 distinct positions which could possibly be the same as the current position. Hence, the upper bound on the maximum number of moves that could result in a threefold repetition is 25.
However, it's very unlikely (dare I say impossible?) that there's a position with 25 possible moves that would lead to a threefold repetition. I believe that the actual number is much smaller. We may never know the exact number. Nevertheless, can you prove that the upper bound is lower than 25?
NB. I'm asking this question because I'm developing a neural network that plays chess. Hence, I'd like to reduce the size of the input to the neural network as much as possible. Providing a history of 25 positions to the neural network is a lot.