So here is my 2 cents. These two things are not mutually exclusive. It is not either "publish a first author paper" or "get multiple middle author papers". From my experience, these two are highly intertwined and opportunities tend to arrive once you have proven yourself/work hard.
The important thing is to a) find a good mentor who publishes and wants to get involved and b) do a good job - become THE PERSON for your mentor. This will breed opportunities where they will depend on you and ultimately lead to publications
I will use my experience as an example:
First thing he had me do was read about his research and discuss with him to make sure I had an idea of what was going on. After that, it involved creating the database and doing hundreds of hours of chart review. This was no small task. I busted my a** to get this done and it did not go unnoticed and I earned his trust. This inevitably led to my own project with the database that I was first author on. He began recruiting other medical students who were interested in research into his lab, except he did not have the time or intricate knowledge of the database/chart extraction to teach them. This led to me becoming the "research coordinator" in essence and it was my responsibility to train people and handle the database. After successfully building his research database, working hard on the opportunities given to me, and being dependable and productive, his trust in me was established and I officially become "The research guy." Opportunities started flowing to me: "I just got an offer to write a commentary on this. Want to do it?"... "Can you help this medical student with a letter to the editor?".... "I have this project that has been sitting around for 2 years and needs a little push, want to take it?".... "Student X is working on a manuscript but it is their first time writing... Can you help them with it?"
I ended up applying to a different field. But the lessons I learned from this research experience allowed me to quickly become productive in my new field as I was fully understood the publication process and was able to contribute to projects in a variety of ways. This is incredibly important - you learn a lot by going through the publication process and helping out on research in a variety of ways. I will be able to intelligently talk about during interviews every part of research (IRB, data collection, statistical analysis, writing, etc). This is the most important thing you should learn as a medical student because you will inevitably be much busier and not have the time to learn this in residency.
so
TLDR; the correct mindset is not "Is it better to get a first author or multiple middle pubs", you need to focus on getting the right opportunity (which in hindsight takes some luck), work incredibly hard to prove yourself and learn everything you can with the opportunities given so you can contribute to projects in multiple different ways. The publications will come once you do this.
Also,
@DNC127 thread is the best example of this. It is the most informative/my favorite thread on SDN. I WISH I would have read his post as an incoming M1. He absolutely mastered this process and took full advantage of the opportunities given. I did this on a smaller scale, but still I would highly recommend reading his thread on research and apply what you can to your situation.