Don't ever dash attack or fair into Olimar. Hell, just don't attack his shield with any move that leaves you on the ground afterwards. That's just asking to take 15%+ from a grab + whatever followup he wants. If he wants to camp you, you could stay in one spot and just continuously nair the Pikmin off (don't worry about it staling, you only need a little tap with it to gimp Olimar anyway). If you manage to get close, attack the high diagonal angles of his shield (i.e. if Olimar is facing left, attack northwest and northeast). Usmash only hits you if it's in between your dairs, otherwise the dair will knock the Pikmin away.
Side Bing straight into Olimar's shield actually isn't a bad idea if it's slightly depleted. Side B pokes shields ridiculously well, and Olimar will have a lot of trouble shieldgrabbing it with his lack of grab armor. Even better if you know the perfect ledge cancel distance. You can push him off with side B and immediately nair. Should be a free stock, if not, chase with dair or another nair. Down B/side B/jump right back to the edge and you're good.
A little trick that good Olimars like to do is uair you from below when you're edgehogging them. The move has deceptively high hitboxes and lasts long, which may outlast your invincibility. Watch out for this when they have 4-6 Pikmin, as it'll allow them to afford the drop from uair and then immediately up B to the edge. By deceptively high, I mean super ****ing high, lol. Uair goes through the sides of Battlefield from under the stage.
If you're above Olimar, you have barely any options. His uair can and will beat your dair. Prepare to take 25% from red Pikmin, 20-22ish from yellow, and close to 20 from blue/purple. Smash DI up to get out of this, the hitbox is pretty wide too. If you can, move to his sides and bair/fair him (this is pretty difficult due to MK's slow air speed though). Being above anyone in this game sucks, Olimar's certainly not an exception.
If you manage to grab him, either fthrow or bthrow him (preferably the one closest to the edge). Bait the dodge, then up B/nair/dair, or if he's at super low percents, uair chains into up B/nair/tornado. Tornado should really only be used when he's landing, otherwise you face the dangers of getting pivot grabbed. Either suck him out of his air dodge with it, or move so his nair won't touch you (it only beats tornado from the top center).
NEVER glide into Olimar! Usmash clashes with glide attack and he'll have frame advantage, uair beats it, and all his other aerials clash with it if spaced right (nair will beat it from a very strange angle, though). He can also shieldgrab it fully spaced with any Pikmin except purple, and if he's fast, fsmash out of shield. Up B also totally demolishes gliding, and if you're not prepared, you might find yourself dying pretty early. I believe the Pikmin CLOSEST to Olimar indicates the type of attack that his up B will do.
If you get hit by nair, SMASH DI UP. This move easily combos into dsmash or usmash, both of which kill MK rather early. His aerials are all really dangerous, but lack range so much that it's almost funny. Fair and bair do something like 13 damage each and will kill you at high percents. Dair's non-spike hitboxes are REALLY strong at the beginning, but not so much afterwards. If he doesn't autocancel his aerials, they all have really nasty landing lag (with the exception of nair, it's not that bad). Punish accordingly, grab/dsmash/ftilt preferred.
Olimar's smashes are straight ridiculous. Dsmash has a nasty angle and will kill MK at around 110 with perfect DI with red and blue Pikmin. Usmash kills around 105 for red/blue and 80, yes, EIGHTY PERCENT, with purple. Luckily you can just swat them away with your dair, but if Olimar sees an opportunity to run in and punish you with usmash, he will certainly take it. This means at high percents, be very sparing with your usage of tornado. It's VERY punishable, and purple Pikmin usmashes will beat it head on. Olimar's fsmash is incredibly safe and long-ranged, and he'll use this as a mix-up as you approach him through his camping (he'll switch between fsmash and grab most of the time, both are very damaging). Purple fsmash is incredibly strong, but luckily has super short range and won't hit you if you're careful with your spacing/approaches. It's not gonna touch you if you're off the ground a little bit. Also, be wary of fsmash when you're on the edge. It has ridiculous active frames that last even when the Pikmin is falling off the stage! He can also grab you from under the ledge with any Pikmin besides purple. Just outguess him on the edge and you should be able to return without problems.
As someone mentioned earlier, never dsmash just to dsmash. The move is ridiculously unsafe on block, especially on a character like Olimar with insane grab range. If you're gonna be using any smash on him, it should be fsmash. It's VERY safe on block vs. Olimar (lol 11 frame grab). Most Olimars with matchup experience will expect the standard fsmash -> dsmash on the shield and continue shielding. I like to follow up fsmashes with dash grabs or ftilts. Dash grabbing is more effective on Olimar most of the time, but it comes down to the opponent's habits and how he reacts when his shield is hit. Choose carefully. Alternatively, you could predict his obvious attempt at trying to shieldgrab fsmash -> dsmash and just spot dodge the grab and punish with dair/dsmash/grab...just try outguessing him. Point is, dsmash is very unsafe, and should only be used to punish (as in, when you're sure it will hit).
Off the stage, be prepared for whistle and air dodge combinations. Nair outlasts the whistle if they're used at the same time, and the weak hit will tap him away. This is enough to either gimp him or set him up for another nair/dair. If he's above the edge, he's got much better chances of making it back. Just wait for him to do something and nair it away (dair if you manage to get on top of him). If you knock him out of his second jump, his stock is yours. Just be wary of the tiny little hop his up B gives him, and its lagless landing on the stage. Shouldn't really be any trouble once you knock him off.
Like I said before, grabbing = lots of damage. Blue throws deal close to 15 damage on their own, plus pummels and followups. Dthrow -> usmash -> uair is over 40 damage with the right Pikmin (blue red red is the proper combination, I believe). White grabs not only have the most range, but deal 3-4% per pummel. They also have the lowest knockback, leading to followups at higher percents than normal. Know what's even worse? Olimar can kill you from his grabs. Blue bthrow will finish you at about 130 with good DI. Purple uthrow kills at about 105...but luckily it's got the least range and Olimar's lack of grab armor makes it difficult for him to grab you that close up (provided your spacing game is on).
Stages to ban:
For the first round, strike FD and Battlefield. Olimar loves both of these stages a lot. My advice is to ban either Halberd or FD. Halberd's low ceilings are very good for Olimar, given that most of his kill power is off the top. FD should be obvious, as he can just freely camp your balls off there, and you have a humongous flat stage to traverse before you can touch him. He's amazing on Luigi's Mansion (if it's legal, it certainly isn't here), but you're good there too. Same goes for Norfair--more ledges for him to grab on, but MK is amazing there as well.
Stages to use:
Rainbow Cruise, Frigate Orpheon, Delfino Plaza, Jungle Japes (where it's allowed).
Rainbow should be obvious for the most part. No ledges for over half the level. However, the ceiling at the top part of the level is insanely low.
Frigate is great on the first transformation, but ends up working really well for him on the second one...it also has a slightly lower ceiling than the neutrals, so watch out.
Delfino is great on almost every transformation. If he lands in water, all of his non-blue Pikmin die. You can camp underneath the stage on the floating platform and Shine Tower parts, which works. The sand mound has a low ceiling, though, and watch for the walkoffs.
Japes is your best choice, but may not be available. The high ceiling hurts him and doesn't affect you at all. He's boned as soon as he's in the water--all his Pikmin will die and the water will rush him off to his death. The varying platform levels help you pressure him, as do thin floors--you can uair him through the platforms on the side if you're feeling ballsy. If this stage is on, take Olimar here! If he bans it or it's illegal, Delfino is probably your next best choice, followed by Rainbow and then Frigate.
Overall matchup ratios:
55:45 MK on neutrals and Halberd, 60:40 on counterpicks.