The first one would be better of the two.
But you would need to reword it slightly like so:
Level stars count only if you finish the level
The second one is slightly ambiguous: -
Level stars are counted only if you finish the level
Could mean that the stars aren't being counted, until after a level is finished, which could be read to mean only stars earned in a later level will be counted. Which is not your intended meaning from your post.
And, is it OK to have two "level"s in the sentence?
As you are using the word 'level' to mean the same thing in the sentence, there is no additional work on the part of the reader to parse the meaning so it works fine I would say. If the words were Homographs, same spelling but different meanings, e.g.
I told him a lie and then went to lie down
This would be less desirable as there is extra work on the part of the reader to parse the meaning. So to answer that part of your question word repetition is always 'ok' but it comes down to a decision on your part as to if the way you have constructed the sentence conveys your meaning as clearly as possible, if it doesn't, then it's time to look at rewording it!
I think this would be be a better construction for your intended use: -
Any stars collected will not count unless you complete the level.
Because it is unambiguous and also avoids that repetition you mentioned which makes the sentence slightly less awkward. If you have more than one type of 'star' in the game, and you need to differentiate the 'level' stars specifically I would go with
Any level stars collected will not count unless you complete the level.