They're both correct, but they're grammatically different. It isn't simply a case of adding or omitting a preposition if you feel like it. If 'lacking' is a verb, you don't use 'in'; if 'lacking' is an adjective, you do.
The sauce was lacking flavour = The sauce lacked flavour.
Here, 'lack' here is a verb, and 'flavour' is the direct object.
The sauce was lacking in flavour.
Here, 'lacking' is a predicative adjective which requires a particular construction:
be + lacking + in + indirect object
I hope that helps.