can I use an aluminium seatpost to install a tagalong on a carbon fiber frame? I've been told not to put a tagalong on my carbon bike because the carbon seat post could crack because they aren't designed to withstand the lateral tension of having the tagalong mounted there.

I'm curious if it'd be OK if I were to just mount an aluminium seat post there instead, and then mount the tagalong to the aluminium seatpost.   Will that risk the frame getting cracked knowing that the tagalong will create some extra lateral tension, or is the mouth of the seatpost hole generally strong enough to withstand a little extra weight?

This would most likely be a temporary installation, so I'm not concerned about the metal/carbon corrosion issue... only about potentially cracking my seatpost hole.
It's in the realm of things where nobody can tell you it's absolutely going to be fine, but it will probably be fine. There are some wimpy carbon frames in the world. Also it depends on how much you weigh, because as far as the frame is concerned, the forces generated by the trail-a-bike are going to be added to those generated from your seated weight. If this is a road bike and you're at around the weight limit already, it's probably not a good idea.