Dropping all fields exept one with QGIS 3 Model Builder

If you don't mind playing around with Python a bit - you could export the model to a Python script using the option Export as Script Algorithm... in the Processing Modeler window.

Then you could inject this piece of code and run the exported script. Of course then you can easily implement your logic of passing the field name dynamically.

#INPUT - fields to remain
fieldsToRemain = ["id", "temp_id"]

#vlayer is a QgsVectorLayer object
fields = vlayer.fields()
print([f.name() for f in fields])

fieldsToDelete = []
for field in [f for f in fields if not f.name() in fieldsToRemain]:
    idx = fields.indexFromName(field.name())


#only the desired fields are left
print([f.name() for f in vlayer.fields()])

You can use the algorithm 'Refactor Fields' in the Model Builder.

enter image description here

For 'source expression' and 'name' in the Refactor dialog, use the field name that you know from your input; that will be the only field remaining in the output vector.

You can use the 'load fields from template layer' option to get correctly-entered fields, then use the 'delete selected field' button to remove the ones you don't want.

enter image description here