If a School of Divination wizard uses the Portent feature on a legendary monster to assign it a failing saving throw, can the legendary monster use their legendary resistance to choose to pass the saving throw anyway?
Excellent question. Yes the legendary creature can still force a success.
How this works is portent needs to make the Legendary creature use the roll from itself before the roll is actually made, thus giving them a failing saving throw immediately. The legendary creature would then uses their legendary resistance which takes place after the roll is made and results determined, declaring the save a success as a replacement effect.
Yes. The Legendary Resistance ability is phrased as "If the [creature] fails a saving throw, it can choose to succeed instead." This doesn't specify anything about whether the saving throw was from a physical dice roll or some other source, just that it can be used to prevent a failed saving throw.
Yes, Legendary Resistance allows the creature to succeed regardless of any modification of the original d20 roll.
Both Elgagard's answer and r256's answer already provide the correct interpretation: since Legendary Resistance can be used once the result is known, then regardless of whether it comes from a classical d20 roll (plus mods) or other abilities, the result of the wizard's Portent feature is overcome by it.
Can the silvery barbs spell in Strixhaven affect Legendary Resistance? No. When a creature uses Legendary Resistance, the creature turns a failed saving throw into a success, regardless of the number rolled on the d20. Forcing that creature to reroll the d20 afterward doesn’t change the fact that the save succeeded as a result of Legendary Resistance. No amount of rerolling will undo that success.
The above clarification is about the silvery barbs spell (S:ACoC, p. 38), but the principle is the same as Portent: both of them may modify the final d20 outcome, one imposing disadvantage and the other directly setting the value, but the Legendary Resistance replaces this very last outcome with an automatic success.
Legendary Resistance requires failing a saving throw. Portent can cause failed saving throws; ergo, Legendary Resistance can create a success instead.
The description of the Legendary Resistance trait states (example text, from the Lich):
If the [creature] fails a saving throw, it can choose to succeed instead.
So this feature can be used any time a monster fails a saving throw. That is the only requirement; if they fail a saving throw, they can choose to succeed.
[...] You can replace any attack roll, saving throw, or ability check made by you or a creature that you can see with one of these foretelling rolls. You must choose to do so before the roll, and you can replace a roll in this way only once per turn.
Notably, this feature activates before the roll, but the end result is all that matters here. Clearly, Portent is able to make a creature fail a saving throw (it would be rather pointless to target saving throws otherwise), so when Portent is used on a creature (with or without Legendary Resistances), it causes them to "fail a saving throw". This, as mentioned earlier, is all that is required for Legendary Resistance to activate, and so Legendary Resistance can be used on a saving throw affected by Portent because it still counts as failing a saving throw.