The only thing Trump probably remembers that's Star Trek themed is "Beam me up Scotty", which he probably said instead of calling her a space cadet. His generation thinks space is a fantasy land of rocks and nerds.
I bet this was it. James Trafficant was a congressman who used to end his speeches by saying "Beam me up" which I understand was a way to say "this shit is crazy / out of this world"
I'd say Trump was the right age for the demographics when Star Trek TOS aired. He would have been 20.
It's just that he would have no interest in a socialist utopia full of diversity and equality, including (mostly, it was the 60s) gender equality and where you talk things out first rather than come in guns blazing.
He's against all of that.
And he probably wouldn't be able to take it when Kirk got the pretty girl and he didn't because TV is reality to him.
Fred Trump and his generation used military school as a way to reform shithead kids before they turned 18. Doesn't seem to have had much impact on Don so Ensign Ricky may not have stuck. Besides, he was talking about Sidney Powell, and gender is important to him, so he may have avoided the comparison because of the misgendering.