Organize imported objects by auto-generating similar named Collections and sorting
You can do it this way. The code is fully commented but ask if something is not clear enough.

import bpy

#Get the collection the objects are
original_collection = bpy.data.collections['Collection']

#Get the root collection
scene_collection = bpy.context.scene.collection

#This dictionary will contain the collections that will be created
#The key is the object's name
dictionary = {}

#Loop over the objects
for obj in original_collection.objects:
    name = obj.name[0:10] # Get the root name (the way you need to)
    collection = dictionary.get(name) #Look if there is already a collection
    if not collection:
        #If not create it
        collection = bpy.data.collections.new(name)
        #Link it to the scene
        scene_collection.children.link(collection)
        #Keep it in the dictionary
        dictionary[name] = collection
    #Link the object to the new collection
    collection.objects.link(obj)
    #Unlink it from the original one
    original_collection.objects.unlink(obj)