Some general Marth ditto tips: In neutral, stay grounded. You can jump for retreating f-airs but for the most part being above another Marth in any situation is worse than being grounded. If your opponent jumps at you, you can screw them over pretty thoroughly by catching them with a tipper F-air and start a combo, or simply with F-smash. Get a feel for the way they play neutral. Dash dance carefully, scouting with d-tilts like you would most matchups. The biggest deciding factor in this matchup is who can earn grabs and punish from them most effectively by pushing the other off stage. Your #1 goal in this matchup should be taking away as much of their stage as you can until you finally force them off. Most of your kills will be edge guards.
You use your d-tilt to poke at them until you can harass them into getting grabbed, either by zoning them out of center stage and catching the back of their dash dance, or by baiting shields. You can get grabs by evading with your own dash dance as well. Finding creative ways to get grabs will get you really far in this matchup. At 0%, you can chain forward throws, but with proper DI they can land and spot dodge. Pay attention to their percent, as around 8-10% (someone should test this for the actual number) f-throw will put them in knockdown. If part of a chain, they should be off stage at this point but I'll get to edge guarding later. If they are going to remain on stage, watch their DI. If they don't DI out, you can either tipper F-smash, or dash jump F-air and tipper them with it to start a harder punish for lower percents. A tipper F-smash will send them off stage in almost all cases. It's up to you if you'd rather go for an edge guard kill or work up damage with a combo.
Marth edge guards himself super hard. If you send Marth any distance off stage that isn't right next to the ledge, you should quickly grab the ledge and start stalling. This will prevent Marth from sweet spotting, and if you force him to land you'll have plenty of time to react and punish. If he falls in range, you can drop off the ledge, jump backwards and B-air him then Up-B back to the ledge. You can look to place this hit right where there jump leaves them. At higher percents it can confirm the kill even if they do still keep their jump. If Marth recovers high, stay on stage and try to force him to go low with aerials. After they go low, look for a chance to steal the edge. Until then, try and land a D-tilt to force them out. If a Marth is trying to ledge stall, do a quick wavedash backwards fast fall and steal it, of if they're stalling wrong you can just do a SHFFL D-air and spike them. If you steal the ledge they'll either Up-B immediately or drop down low and do it. If they Up-B early, just roll back on stage and F-smash. If they drop down low you can drop down with them and F-air them to death. There's also the "Marth Killer" in which you roll forward toward the ledge, hold Z and the stick toward the ledge to tilt the shield. You'll steal the ledge if he hits you with Up-B TL;DR: Force Marth to recover low and cover his limited options.