How to predict which machine will act as motor or generator in Hopkinson's test?
You don't predict.  You choose.
The diagram shows a rheostat in the field coils of the motors.
You turn the field current of the designated generator to zero (maximum resistance on the rheostat) and set the field current of the designated motor high enough for it to run (rheostat resistance somewhere in the middle.)
With that setup, you apply power and your motor turns.  The motor drives the generator, but the generator doesn't produce any power because its field windings aren't energized.
Next you adjust the motor field current to make the motor turn at its rated speed.
Now you can increase the field current on the designated generator and carry out the test.

Hopkinson's test is described in some detail on this site, which also seems to be the source of the diagram you used.
The description of the test on that site seems fairly clear and complete.