How to access the Kemap settings Preferences (Spacebar Action, Select Mouse button, etc) with python?
Search the source
With Developer Extras turned on hover over the enum and  choose edit source
This will open up (for me)  scripts/keyconfigs/blender.py
    # General settings.
    col = layout.column()
    col.row().prop(self, &quot;select_mouse&quot;, text=&quot;Select with Mouse Button&quot;, expand=True)
    col.row().prop(self, &quot;spacebar_action&quot;, text=&quot;Spacebar Action&quot;, expand=True)
    if is_select_left:
        col.row().prop(self, &quot;gizmo_action&quot;, text=&quot;Activate Gizmo Event&quot;, expand=True)

Notice there is a generic property update method load(self, context)
def load():
    from sys import platform
    from bpy import context
    from bl_keymap_utils.io import keyconfig_init_from_data

    prefs = context.preferences
    kc = context.window_manager.keyconfigs.new(IDNAME)
    kc_prefs = kc.preferences

Ok then to the python console
&gt;&gt;&gt; C.preferences.keymap.active_keyconfig
'blender'

&gt;&gt;&gt; C.window_manager.keyconfigs['blender'].preferences['spacebar_action'] = 2

will set to the third option.  The item that matches that number is available enum definition of the the Prefs class.