In which file to use $wpdb and its functions for database operations and queries in wordpress?

About your specific Problem? maybe you should have a look at your permalink settings. index.php/students doesn’t look right.

The other thing: Why would you want to insert data into the database by using wpdb with data that is submitted from the frontend? The security risk is monumental, and if you don’t exactly know what you do (which i assume looking at the question, no offense), you can not possibly make it safe. Or, to say it in memes: Do you want a hacked database/site? Cause that’s how you get a hacked database/site. 😉