They'd probably need a port or something, first.
Yes, definitely. Basically, to get a significant colonial empire, San Marino needs to develop into a significant European state. To develop into a significant European state, it must first be a significant Italian state. To become a significant Italian state, it has to first be a small Italian state. However (and I think this is the hard part) it needs to change from a village to a small Italian state in its own right.
(Disclaimer: I really have no idea what I'm talking about.)
Here's my suggestion: Spoleto badly beats up Ravenna at some point, but then falls into a conveniently timed civil war. At this point, there is thus a power vacuum in Rimini, which is ssolved by the extension of the Sammarinese government over the region (probably as a result of a convoluted power struggle among the Spoletan contenders, what remains of Ravenna, and some ambitious Sammarinese archon(s)). In any case, the subsequent and prior wars devastate the area enough to give our San Marino a leg up over whoever else threatens it. Probably the capital is moved to Rimini, although the state could well retain its name.
From there, we have a state I presume would be pretty stable. If it can come out of the Black Death all right, it has a decent chance of developing into the one to reunite Italy. From there, establishing a colonial empire is easily achievedl after all, OTL Italy had a bigger empire than Belgium did.
The above may seem pretty plausible. Assuming it does, the unlikely part is that there would be a direct homology between such a notable state ITTL (uniting Italy) and IOTL (an anachronism, a reminder of the times when Europe was made up of tiny political units, sometimes extending no further than a cannon could fire from a city’s walls). Possible, but statistically rare.