When I boarded my first ship, myself and the deck cadet both wore our dress blues. Caused quite a stir onboard. This particular ship (Company- APL- still around, after a fashion), required all officers and cadets to wear khakis, with rank insignia (shoulder boards and collar devices) at meal time. It was my understanding that this was the Master's preference. I know that part of the reason was that we carried 12 passengers who dined with the officers. I do know that I never boarded in my dress blues again and also never wore my khakis with all the flare ever again, while at sea. I often wore my khakis at meal time/off hours.
As an engineer, I would recommend either coveralls, or work pants and shirts (Dickies comes to mind) for engine room/working apparel. I know that when I was going to sea, both as a cadet and after, I ultimately found that the work pants and shirt were more comfortable for general watch standing and day work. Real grimy work like changing a piston, working in a boiler or crankcase was best done in coveralls.
It probably wouldn't hurt to have a pair or two of khaki pants and a shirt.
As far as what to where when boarding, just some clean, neat khakis or "business casual" attire. You never know what kind of officers are onboard.