How many words should be taken as features in a ML problem?
It depends on many factors: number of instances, number of classes, token/type ratio, etc. A common basic technique in order to avoid having too many words is to discard the ones which appear rarely, for example by discarding all the words which appear in less than 3 documents. Selecting only the top $N$ most frequent words is unusual, even though it's a similar idea. There is a risk to end up mostly with words which appear frequently and don't have a good discriminative power.
The proper way to determine an optimal threshold, for example the minimum frequency $N$, is to run a training/testing experiment for every value of $N$ and select the value corresponding to maximum performance. Note that this experiment should use a validation set different from the final test set in order to avoid data leakage.