"in time" versus "on time" in this context

Solution 1:

"to be on time" means to be punctual.

The movie started on time

The movie did not start earlier or later than stated in the showtimes.

"to be in time" means to arrive at a destination with some moments (or minutes) to spare.

Dave's taxi got stuck in traffic but he was still in time for his flight.

Note the preposition "for". You can arrive in time for an event or an appointment.

Thus the textbook answer is the most appropriate

I would strongly advise you to be on time to the lecture.

Solution 2:

I think it's not a mistake.

'On time' means 'not later the exact time'.

For example, students should be in the lecture room exactly at the appointed time.

'In time' means 'before the exact time'.

For example, students should be in the lecture room before the appointed time.

The author of the textbook wants to underline the fact that it's not necessary to come before the lecture, and it's quite all right to enter the lecture room at the appointed time.