You can use this plugin to do that via an uploaded csv file: "Upload enrolment methods" https://moodle.org/plugins/tool_uploadenrolmentmethods.
Although requested seven years ago, the core Moodle course upload tool still does not support Cohorts as an enrolment method, https://tracker.moodle.org/browse/MDL-43127 so this plugin still fills that gap for Cohort and Meta enrolment methods.
Although requested seven years ago, the core Moodle course upload tool still does not support Cohorts as an enrolment method, https://tracker.moodle.org/browse/MDL-43127 so this plugin still fills that gap for Cohort and Meta enrolment methods.