what should i do if my target variable is categorical when using decision tree? (many categorical variables)
This is called multiclass classification, and the encoding needed for the target variable depends on what package and model you're using.  You may be expected to one-hot encode (e.g. neural networks usually have an output neuron for each class), ordinal encode (e.g. most(?) sklearn multiclass classifiers), or leave them as strings (most R models, I'd guess?).