Is it possible to set names of objects based on their texture name?
this is for texture name assuming the texture is on the first material :

import bpy

C = bpy.context
D = bpy.data

objects = [obj for obj in D.objects if obj.type == 'MESH']

for obj in objects :
   nodes = obj.material_slots[0].material.node_tree.nodes
   tex_node = next((node for node in nodes if node.type == 'TEX_IMAGE'), None)
   if tex_node :
       img_name = tex_node.image.name
       img_name = img_name.replace('.jpg','')
       obj.name = img_name.replace('.png','')


incase its the material name :

import bpy

C = bpy.context
D = bpy.data

objects = [obj for obj in D.objects if obj.type == 'MESH']

for obj in objects :
   obj.name = obj.material_slots[0].material.name
   #obj.material_slots[0].material.name = obj.name   #if it's the other way