I am teaching intro Arduino coding to 92 seventh graders in a computer lab. Each class size is about 16. When the Arduino IDE automatically opens up the previous student's work it is a huge problem. With the original Arduino IDE I was able to edit a preferences file to disable auto-opening of the previous sketch. However, I haven't been able to figure it out with the 2.0 IDE.
I'm not aware of a setting that can be used to disable the restoration of the previous sketches on startup. If you like, you can submit a feature request to the Arduino IDE developers here:
My first idea was to pass the path of a specific sketch to the IDE as an argument (which can be done via a shortcut, file association, script, etc.). This sketch could simply be the code you get from File > New. You would need to do something to prevent the users from saving changes to this file. That could be done by making the file read only, or having a script that resets the file after each IDE session.
Perhaps a better approach is to clear the data used by the restoration feature. This is stored in two different files in two different locations:
The recentRoots field of <configuration folder>/recentworkspace.json
The workspaces field of <user data folder>/config.json
If you want to get fancy, you could use a tool like jq to clear the specific fields of these files. But you can also just delete the two files entirely without causing any problem.
One option, perhaps not as elegant as the previous suggestion, is to provide each student with their own desktop folder that contains a shortcut to a blank Arduino project saved with the students name eg. JohnDoe_template.ino. Subsequent projects would be saved in the students own folder maybe a sub folder called JohnDoe_repo. It promotes an intro into being organized.