Any codes on the engine computer? Get to Josh's page for the procedure:
http://www.surrealmirage.com/subaru/subaru.html
Click on 'notes and tips' then on 'engine related'. Not all codes trip the check engine light.
Not sure the order of importance, but look into:
IAC, Idle Air Controller. This gizmo needs to be checked out for operation and additionally needs a good cleaning. You'll need a manual for this. The Haynes will do, or get a subscription to
www.alldatadiy.com .
intake ductwork; any breaks or opening between the air flow meter and the intake manifold will make it idle funny. The rubber boots may have cracked and will need to be repaired (cloth & rubber cement).
vacuum gauge. any vacuum leaks in the intake manifold?
Let us know what you find.
Nick