I don't think there's a way to automatically delete users. There is a "longtimenosee" variable in the site variables page found in the site configuration that lets you set the number of days before an inactive user becomes unenrolled from their courses.
If (now - lastlogin > x) then remove account.
Still, in cases where you are sure that students have not posted anything, it might make sense to delete them entirely especially if it would cause a huge bloat of the database table if they weren't -- in cases where you've got 1000+ dormant records, etc. Otherwise, I doubt if keeping them in the database causes much of a performance hit at all.
a little program (with a list of accounts) or checkboxes in the userlist may help to delete lots of ex-students ..
is this possible?
Yes, because their records are stored in the Backup XMLs of the old courses...
Maybe a nice idea to have a module that can visualize queries in these course-backups?
(Show me the information from Jan in course 101 year 2003-2004, about ...)