How do you know if a collection has been clicked on by the user using Python?
It’s easier than you might think: Either get the collection in context (C.collection) or the collection of the active View Layer (C.view_layer.active_layer_collection). Both attributes return a reference to the selected collection in the Outliner allowing to access the name of the collection by using its name attribute to compare against.
Adding the following poll method to your panel class will only return True in case the selected collection is called MyCollection and thus display the panel:
@classmethod
def poll(cls, context):
    return context.collection.name == &quot;MyCollection&quot;


Code based on ui_panel_simple.py template:
import bpy


class HelloWorldPanel(bpy.types.Panel):
    &quot;&quot;&quot;Creates a Panel in the Object properties window&quot;&quot;&quot;
    bl_label = &quot;Hello World Panel&quot;
    bl_idname = &quot;OBJECT_PT_hello&quot;
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = &quot;object&quot;

    @classmethod
    def poll(cls, context):
        return context.collection.name == &quot;MyCollection&quot;

    def draw(self, context):
        layout = self.layout

        obj = context.object

        row = layout.row()
        row.label(text=&quot;Hello world!&quot;, icon='WORLD_DATA')

        row = layout.row()
        row.label(text=&quot;Active object is: &quot; + obj.name)
        row = layout.row()
        row.prop(obj, &quot;name&quot;)

        row = layout.row()
        row.operator(&quot;mesh.primitive_cube_add&quot;)


def register():
    bpy.utils.register_class(HelloWorldPanel)


def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)


if __name__ == &quot;__main__&quot;:
    register()

Further reading:

How to create a custom UI?
What do operator methods do? (poll, invoke, execute, draw &amp; modal)