Which sentence is correct and why?
If the number of unique items is few
If number of unique items are few
Note:
Should I use the?
Should I use number or numbers?
should I use is or are?
Yes, you should use the article in front of number.
If it is one set of items you are talking about, it is one number of items, so you use the singular.
Number is singular, so you use the verb in the singular.
However, there is another point: the use of few. Few means that there is a small number of items, but the number is not few, its is small. So you could say the following:
If there are (only) a few unique items...
or
If the number of unique items is small...
Mixing them up is comparable to "that item costs expensive", which is a mix of "it is expensive" and "it costs a lot".