I guess i need more specifics
Does it turn the engine over when it acts up
do the gauges and idiot lights come on when this happens.
Does it make a single click in the engine compartment
Is it auto or stick
Or is it cranking the engine but not starting
The starter installed what brand was it and how much did you you pay for the part not labor part A lot of aftermarket starters are junk. let me refrase that in a less offensive manner a lot of atermarket Subaru starters are ABSOLUTE JUNK worth less than their weight in scrap steel. And can and will have the exact same problem the starter you traded in had.
I only use Genuine Subaru starters they usually are within $50 of aftermarket starters, You are describing one of a few things battery cable ends or connections dont forget the grounds. Corroded wire positive terminal side that feeds the engine compartment fuse box or terminals corroded in that fuse box I have seen some realy bad ones. Ignition switch or the connector that feeds the ignition switch is burnt I used to see this in the early 90s models from time to time very similar set up on yours.
Next time it does this turn on the headlights (assuming they won't work because of the problem) and start jiggling the cables, relays, grounds, etc until you see them pop on. Then you'll know where the problem is. I suspect the cables because it is common for them to fail inside the factory insulation on most cars even though they look good and clean. If the headlights work but you still have this problem, I would suspect the ignition switch circuit.