The introduction comes first in the research paper, but I have found it is easiest to write it last.
Although the introduction may be an easy part of a research paper, it is still very important. It is the very first opportunity that you will have to get the reader interested in your project and compelling them to read the rest of your paper. It should very quickly in the first paragraph indicate what this paper is going to be about and why it is important. Then the remaining paragraphs can elaborate on these statements. When I was in graduate school a prof. once told me it was important that the introduction answer the "so what" question. Thus, it should be very clear what this study is about, how it will make a meaningful contribution to the research, and why studying this is important.