... before the exchange or intervention of/on the engine.
It comes from "exchange of the engine" and "intervention on the engine".
Which one should I use?
Additional example with lack of preposition:
Do not move or stay close (x)/to the engine.
The appropriate preposition for a given verb is really just a matter of custom, and there is no real way to escape learning them with the verb. Many verbs have more than one suitable preposition, with different meanings: sometimes the meanings are very different indeed.
For your examples the prepositions are:
If you have two verbs (for example joined with "and" or "or") which require different prepositions, formal English includes both and less formal usage often just uses the preposition closer to the noun. In practice it is guided more by sense than any rule.
Here's a list of matching pairs from the British Council https://learnenglish.britishcouncil.org/intermediate-grammar/verbs-and-prepositions
And another of phrasal verbs: https://learnenglish.britishcouncil.org/english-grammar-reference/multi-word-verbs