Subaru rough idle

I have a 2003 Subaru Outback, 78,000 miles. It idles very rough while in drive, not in neutral or park. My mechanic isn’t sure what is causing it. Any ideas?

The first step is to always rule out a mechanical fault and that means a compression test.
If the compression is good then there is not enough info provided to make a guess.
Plugs, wires, coils, vacuum leak, faulty injector, bad mount, Check Engine Light on, codes pulled?, etc, etc, etc.