Classification Threshold Tuning with GridSearchCV
As far as I know you cannot add the model's threshold as hyperparameter but in order to find the optimal threshold you can do as follows:

make a the standard GridSearchCV but use the roc_auc as metric as per step 2
 model = DecisionTreeClassifier()
 params = [{'criterion':[&quot;gini&quot;,&quot;entropy&quot;],&quot;max_depth&quot;:[1,2,3,4,5,6,7,8,9,10],&quot;class_weight&quot;:[&quot;balanced&quot;]}]
 GSCV = GridSearchCV(model,params,scoring=&quot;roc_auc&quot;)
 GSCV.fit(X_train,y_train)
 GSCV.best_params_
 best_model = GSCV.best_estimator_


Once you have the best hyper parameters set you can obtain the threshold that maximizes the roc curve as follows:
 from sklearn.metrics import roc_curve
 preds = best_model.predict_proba(X_train)[:,1]

 fpr, tpr, thresholds = roc_curve(y_train, preds)
 optimal_idx = np.argmax(tpr - fpr)
 optimal_threshold = thresholds[optimal_idx]



This threshold will give you the lowest false positive rate and the highest true positive rate