You can suspend multiple users using a .csv file.
This will prevent the users from logging in, but their data is preserved.
See the attached file for instructions.
Further information from https://docs.moodle.org/34/en/Unenrolment#Suspended_or_Unenrolled.3F
Suspended or Unenrolled?
Suspended users are no longer able to access any of their courses on Moodle but their data is preserved, so it is possible for them to return to their course at a later time. This might be useful for example, for keeping safe the work of students who have left the establishment but whose data might be needed for inspection in future years. Suspended users currently still appear in the gradebook but a teacher can select in their Grader report preferences to show only active users or all users (including suspended users). See Grade settings for more details.
Note: A teacher may suspend a single user or groups of users from a particular course by changing their status in Users > Enrolled users>Edit enrolment . It is also possible to suspend users from courses via csv/text file from Site administration > Users > Accounts > Upload users using the enrolstatus field, where 1 against a user means they are suspended (and leaving blank means they are still enrolled.)
Administrators can suspend user accounts, meaning the student cannot access any courses, by editing the profile and checking the "Suspended account" box.
Unenrolled users do not normally retain any data and will not appear in the gradebook. However, see #Unenrolment and grade history Unenrolment is typically more final than suspension.