How to "Hide a Collection in viewport" but not "Disable in Viewport" via script in Python
You can hide the active collection using the following code:

bpy.context.view_layer.active_layer_collection.hide_viewport = True


If you want to hide more than the active collection you will have to iterate through the children of layer_collection

collections = bpy.context.view_layer.layer_collection.children

for collection in collections:
    collection.hide_viewport = True


Be aware that bpy.data.collections and bpy.context.scene.collection also allow to access the collections and set hide_viewport. However, since these do not depend on the active view layer, they apply globally and therefore activate Disable in Viewports.