I could suggest a PyQGIS way of implemeningimplementing this task.
# referring to a needed layer
layer = iface.activeLayer()
# creating a temporal layer from selected features
temp_layer = layer.materialize(QgsFeatureRequest().setFilterFids(layer.selectedFeatureIds()))
# specifying important fields
needed_fields = ["id"]
all_fields = [field.name() for field in layer.fields()]
other_fields = list(set(all_fields) - set(needed_fields))
# getting indexes of other fields
idx = [temp_layer.fields().indexFromName(field) for field in other_fields]
# deleting other fields based on their indexes
temp_layer.dataProvider().deleteAttributes(idx)
temp_layer.updateFields()
# adding temporal output to the map canvas
QgsProject.instance().addMapLayer(temp_layer)
References: