Preventing authorship conflict
If it is possible to determine at the outset who will make the greatest contribution to the research, then you may do so, and set the author order in advance.
In the (more likely) case that you have to actually go through with the research in order to see who contributed the most, then it's probably best to save discussions about author order until the end.
I'm not sure I understand your concern about students competing to &quot;produce better work.&quot; If students are overstating their own contributions or sabotaging each other's work, then that is an issue to bring up with the PI. But anything short of that can only be good for the research project, no? How inclined would you be help out with a project if you were told at the outset that you would be the lowest-ranked author?
Participating in the research for its own sake, rather than because you think that doing a little more will earn you the spot of second author instead of third, is an essential component of academic maturity. But because people aren't perfect, allowing the final author order to adjust in acknowledgement of participants' actual contributions is the best way to incentivize active research participation.
In some fields, you may also consider alternative author-ordering schemes such as alphabetical.