No, it can't be used on a spell attack
Attacks are broken down into weapon attacks and spell attacks.
Each of these can be either a melee attack or a ranged attack. So any attack must be one of the following:
- Melee Weapon Attack
- Ranged Weapon Attack
- Melee Spell Attack
- Ranged Spell Attack
Except for a few rare cases, if you're casting a spell that gives you an attack (like in the case of thorn whip), you'll be making one of the latter-most two. Some non-spell abilities grant spell attacks, too.
In every case, the spell or ability will tell you which of the options above you're making. In the case of thorn whip, the relevant part of the spell description says:
Make a melee spell attack against the target.
So this means you're making a spell attack with thorn whip, not a weapon attack.
The Battle Master fighter's Precision Attack maneuver states (PHB, p. 74):
When you make a weapon attack roll against a creature, [...]
This means that it only works with attacks of the first two kinds, where the character is making a conventional attack with a some sort of weapon held in hand(s). Notably, it can be a melee or ranged attack (Precision Attack doesn't care which); it only matters that it's a weapon attack, and not a spell attack.
Because thorn whip involves the character making a spell attack, that character can't use Precision Attack on that attack.
By way of example, there are spells that would benefit from the Battle Master fighter's Precision Attack such as Booming Blade or Green Flame Blade because they involve a making melee weapon attack.