I agree with @thoka, if you want to assign a badge manually in order to grant access to a group, then an invitation can be as quick.
If you need/want a badge associated with each group, then you could create new badges SQL query to give badges to users depending on the groups they belong to: Create Triggered Custom Badge Queries
With this combination, you’ll be able to put students in groups and have them have a badge, all of this without having to create a custom plugin.
As an alternative, as @Heliosurge suggested, you could maybe use the Automation official plugin to set users in a group depending on a custom field value. There’s a script for this:
I don’t know how it works but I believe it would require some custom code to make it work.