Where was the red plastic found? You should have a fuel filter on your engine. The filter is a 10-15 micron filter. The filter should have caught the plastic. Did you or the mechanic change the filter? The filter should be replaced every 250 hours or the end of season, whichever occurs first.
A little bit about diesel engines. I am not a diesel expert, but I do read a lot and talk with others. The reason people like diesel engines for their boats is because they are designed to run at a constant speed and will last forever if properly maintained (i.e. scheduled maintenance). The number one thing that will kill your diesel engine is dirty fuel. That is why so many people are so anal about where they get their fuel and their fuel filters.
You should get your fuel from a place that dispenses a lot of fuel. It will more that likely be cleaner fuel than a place that does not dispense so much. You should keep your fuel tank full so it does not develop condensation in the tank. Water in the fuel can destroy the engine.
People like to use two fuel filters in the fuel system to catch the water and crud that could be in their fuel. Normally you would have a Primary Filter of 20 or 30 microns just off the tank and a Secondary Filter (5 or 10 micron) between the Primary and the engine. You can get very carried away with the filter system by having 2 Primary's and 2 Secondary's, etc. It is essential to have at least one good filter. Evidently, Yanmar thinks one filter of 10-15 micron is sufficient for your engine. Many tug owners have installed another filter off the tank (Racor is deemed the best). Ranger now installs a Racor 110A filter right off the tank on the R21-EC tugs, and it has a 10 micron filter. So, the newer R21 tugs have two 10 micron fuel filters in their system.
If your engine "just stops" such as your did, the first thing you should troubleshoot is the fuel filters. You should always carry a spare filter. Some people have gotten such dirty fuel that they had to replace all the fuel in their tank because replacing just the filters was not good enough.
Well, there you go. I would ensure the filter in your fuel filter on your engine has been replaced, and get another filter for a spare ($5.40 from Ranger - get 2, they are cheap). If you want to install another fuel filter like the Racor 110A, that will be around $100 plus hoses. The filter for the 110A is about $19 from Ranger.