As others had mentioned there is no direct function to identify if a user is a student or not. You can use the following techniques to do what you want.
This function returns true if a user is assigned a 'Student' role anywhere in the system. This works Universally and is not context dependant unless you want to specify it in the 3rd parameter.
user_has_role_assignment($USER->id,5); // $roleid == 5 for student role //inside functions declare "global $USER;"
Next is context based. Get the context in which you want to identify the user.
$cContext = context_course::instance($COURSE->id); // global $COURSE
Assuming that the student has only been assigned one role.
$isStudent = current(get_user_roles($cContext, $USER->id))->shortname=='student'? true : false; // instead of shortname you can also use roleid
This assumes that the students alone have no access to edit/update the Course
$isStudent = !has_capability ('moodle/course:update', $context) ? true : false;
Check out this forum as well. I have given more details here.