Because you're asking for a spacecraft, there is some wiggle room because spacecrafts can make adjustments. An orbit around the Moon isn't stable both because of proximity to a much more massive body (the Earth) and due to the Moon's unusual lumpiness, but spacecraft can and have orbited the Moon when the orbit of least change is selected around the Moon and the spacecraft is able to make adjustments.
In your scenario (which I'll get to in a second), and doing some bad math which I won't retype here, the trefoil orbit of the smaller body (green), if it's a spacecraft does work. I'm not sure why anyone would need a spacecraft to have such an orbit, but in your 3 star system, a trefoil orbit like that with occasional adjustments does work.
The problem is, your 3 star system would never happen.
It appears to be 2 central stars (Yellow and Blue) in a circular orbit around each other with Pink, more distant, in a circular orbit around the Yellow-Blue barycenter. That much is fine, though both orbits being near circular is unlikely, but for a 3 star system to be stable, it needs to resemble 2 separate Kepler orbits, because an actual 3 body orbit where the 3 bodies are all massive and close, is always unstable. You did the central 2 stars orbit each other and the 3rd, star orbits the inner two, but your Pink star is too close.
Your Pink star is 289 distance from the barycenter of Yellow-Blue and Yellow and Blue are 84 distance apart for a ratio of 3.4 to 1. That's too close to be realistic. There should be some eccentricity as well.
As your system is set up, Pink would exert tidal forces on Blue-Yellow and the system would destabilize. Granted, you could avoid tidal forces depending on your units and the distance in the system, if you make the distances that much greater than circular orbits become less likely.
A final point, while you've set up a system where Green passes neatly between the Yellow-Green barycenter and Pink over several orbits, over the long term that would inevitably destabilize. Green is also in a retrograde orbit which is less common. You've set up an interesting system, but you didn't run it enough times to see the long term outcome, so it's problematic for several reasons. Even if you balanced it just right so that it runs for a number of orbits, your system is unlikely to happen the way you designed it.
That said, certain trefoil orbits might be possible at least for a reasonable amount of time. What's required is a 3/4 resonance and two massive bodies. If you want to view the trefoil from a fixed point or barycenter. If you view from one of the orbiting bodies, then I can give you an example. Titan and Hyperion kind of do it, though both orbit Saturn in simple Kepler orbits when viewed relative to Titan, Hyperion has a trefoil orbit.
Your example of a retrograde orbit that passes between the two central stars (Yellow-Blue) and the outer star (Pink) probably a lot more rare and less long term stable (I would think), but running long term simulations is the stuff of computers, not my rough calculations.
However, with so many asteroids and comets moving about, maybe something like what you've set up might be rare but possible, if you could find a 3 star system that somewhat resembles your system, and that might be the biggest problem.
I did some looking and most 3 star systems are defined as "binary" with "companion" that is, 2 stars that orbit each other and a 3rd more distant star that much more slowly orbits the 2 inner stars. I only checked a few though.
You might try to recreate your system with the 3rd star - Pink, at least twice or three times as far away, to get a more realistic set of circumstances. It doesn't look like you can enter resonance orbits in your input, but try to look for orbital periods that work out to 3 to 4. Orbits often look like petals of a flower when viewed from the right vantage point, so an orbit kind of like your setup might happen in the right circumstance.