Select vertices by their indices (by vertex id)
I have modified the code from this answer to solve the problem, where I have replaced  if vert.index == index: to if vert.index in indices: where indices= [1, 2, ...]

example :

import bpy
import bmesh

indices = [1, 3, 4, 7, 8] 

obj = bpy.context.object
me = obj.data
bm = bmesh.from_edit_mesh(me)

vertices= [e for e in bm.verts]
oa = bpy.context.active_object

for vert in vertices:
    if vert.index in indices:
        vert.select = True
    else:
        vert.select = False

bmesh.update_edit_mesh(me, True)