A burned hand teaches best, so they say.
Planet A designs their ships with at least half-dozen major "subsystems" or "components" designated that the system will not work without, and cannot be substituted or developed by Planet B without more knowledge than they have, designated and physically segregated in the design. In short, the key systems B really, really needs to reverse-engineer. More would help, but that will also make it harder to hide or repair.
Planet A then designs a half dozen more...um, decoys, and gently inserts them into the design. Some of which might be "backups" or otherwise connected to the major subsystems or components kept secret, some of which are red herrings to other systems, some of which just sit in the middle of jumbles of wires and look pretty, some of which would disrupt or destroy things if they were wired in like they look (but nor are) actually wired in, some of which are failures that look plausible and have science behind them but which simply could not be made to work. Like the major systems, these should be physically segregated.
It happens like this: Planet A makes a prototype or two, and wires them up to the gills. Each of the critical systems and decoys are made modular, in a plug-and-play component style, well sealed and protected, and rife with spyware and sensors so that Planet A will know, as soon as Planet B's engineers get their grubby little hands in any of them. And, oh, didn't I mention the booby traps? Each system will have booby traps, fail-safes, fail-hards, breakpoints, and planned failures built into these prototypes.
So, when Planet B gets their hands on the prototypes, well in advance of the rest so they can start with familiarization and training before others arrive, Planet A gives very clear warnings on not disturbing the sealed systems, because those systems are delicate and any damage is likely to make them...dangerous. Not destruction-of-the-ship dangerous, but loss of subsystem, explosions or contamination, danger-to-crew dangerous. Bonus points if the systems each have their own dangerous failure, extra bonus points if they can include technobabble that makes the failure "inevitable" unless someone familiar with that system is on hand to deal with it. The point is, of course, these are safety warnings, and not anti-spy or anti-reverse engineer precautions, right? (You should maybe have one or two of those per system, too, just so they don't get paranoid, and your precautions don't fail. Self destructs and whatnot).
I'm sure you can see where this is going.
Planet B does, after some time, try to work around said closed components, and disaster exactly like what planet A said would happen, happened. With damage, possibly losing people, having to wait for repairs, delaying war preparations, and not even getting useful tech knowledge out of it. And they must admit it to Planet A, who has to repair and fix and sigh over "miscommunications" and not warning about dangers clearly enough, and quietly ask if Planet B is sure they are... capable... of dealing with such dangerous advanced technology?
Since these prototypes are wired up with sensors and power backups, Planet A can detect and remote trigger such traps even if Planet B's engineers are very careful with how they try to sneak in. Not really cost effective to monitor all the ships during a war, but certainly possible for the prototypes, yeah? The war-ships will be less likely to go off accidentally with fewer booby traps, and harder to detect with fewer sensors (though still, not none) - but a few scare stories about the other things that can happen when these sealed components suffer unusual damage should encourage the crew to see a failure without the expected danger as a possible sign of something worse, the better to get it looked at - by Planet A technicians - ASAP, and not seen as a sign to try poking at it more. But even if they do (successfully) poke, they have about a half a chance at finding a useless or even dangerous decoy instead of useful technology.
So, the actual ships, with less oversight and fewer traps, will still be pretty safe from meddling because Planet B now has reason to believe the dangers coming from trying to bypass Planet A's safety warnings. Those components will have to be plug-and-play, no repairs in situ (unless you can have Planet A technicians in each ship), but anything else can be repaired or back-engineered by Planet B.
Due credit to Mormacil for the idea of a Schrödinger Drive, Tony Ennis for red herrings, EngelofChippolata for obfuscation.