Stop creating new collection if there is one with the same name already in the scene
Check it exists and is linked to scene.
IMO Two tests required here, one to test if collection exists, and secondly if it is linked at any level to the current scene.  A quick test for the latter is to see if the scene is a user of the collection.
import bpy
context = bpy.context

# name of collection
name = &quot;Foo&quot;

scene = context.scene

coll = bpy.data.collections.get(name)
# if it doesn't exist create it
if coll is None:
    coll = bpy.data.collections.new(name)
# if it is not linked to scene colleciton treelink it
if not scene.user_of_id(coll):
    context.collection.children.link(coll)

Related
How to get all collections of the current scene?