Fastest query to find rows of a collection that lack values in a multi-reference field

First of all, I’d create a backend function (in a jsw file ) to run the queries.
You don’t want to go back and forth over and over again, it takes too much time and too many resources.
The query itself depends on how many students you have. If it’s not too many I’d query them in parallel instead of waiting for each student separately.

For example:

// backend/students.jsw
import wixData from 'wix-data';
export function getStudentAddinalInfo(studentIdArray){
return Promise.all(studentIdArray.map(id => wixData.queryReferenced("Students", id,"classes")))
.then(res => {
return res.map(e => e.items);
})
}

//and you can combine other queries into this promise all as well