I would use a painters caulklike DAP’s Alex plus.
this will allow for any expansion or contraction of the molding without cracking as spackle or wood filler tends to do. i used wood filer on new window installation and wound up removing the filler and using the caulk, no mor cracks