What are the odds of this item generating as a trade in a Master-level Weaponsmith?

≈0.000819%

I'm not really confident in this answer, especially since it's such a ridiculously low chance, so please feel free to correct me if I made any errors in my calculations. I used a Haskell program (source) to do this.

Explanation

Calculating the enchantment level

According to the Minecraft Wiki page on Trading, a master weaponsmith uses a random enchantment level from 5 to 19 (inclusive). Looking at the 1.17.1 source code, each number from 5 to 19 has an equal chance of being chosen (it uses Random#nextInt).

Then, according to the Minecraft Wiki page on enchanting mechanics, this enchantment level is modified with the formula modified level = base level + randomInteger(0, enchantability / 4) + randomInteger(0, enchantability / 4) + 1. The enchantability of diamond swords is 10, so this comes to moidifed level = base level + randomInteger(0, 2) + randomInteger(0, 2).

base level = randomInteger(5, 19)
modified level = base level + randomInteger(0, 2) + randomInteger(0, 2) + 1
bonus = 1 + (randomFloat() + randomFloat() - 1) * 0.15
final level = max(round(modified level * bonus), 1)

Enchanting/Levels on the Minecraft Wiki has a list of the final modified enchantment levels required to get a particular enchantment.

Enchantment I II III IV V
Sharpness 1 – 21 12 – 32 23 – 43 34 – 54 45 – 65
Smite 5 – 25 13 – 33 21 – 41 29 – 49 37 – 57
Bane of Arthropods 5 – 25 13 – 33 21 – 41 29 – 49 37 – 57
Knockback 5 – 55 25 – 75
Fire Aspect 10 – 60 30 – 80
Looting 15 – 65 24 – 74 33 – 83
Sweeping Edge 5 – 20 14 – 29 23 – 38
Unbreaking 5 – 55 13 – 63 21 – 71

So to get enchantments of Sharpness III, Looting II, and Fire Aspect I or better, you would need a modified enchanting level of 24 – 65. For villager trades, there's only a 2.07% chance that this final level will be within this range.

The easiest part was calculating the probabilities of the modified enchantment level (before the bonus) as the random integers all have an equal probability. The sum of the 2 random floats has an Irwin-Hall distribution (n=2) I believe, so I used the CDF for that to calculate the probabilities of the bonus falling within a certain range depending on the modified level from the previous step.

Selecting the enchantment

Each enchantment also has a weight that determines how likely it is to be chosen.

Enchantment Weight
Sharpness 10
Smite 5
Bane of Arthropods 5
Knockback 5
Fire Aspect 2
Looting 2
Sweeping Edge 2
Unbreaking 5

After the first enchantment is chosen,

The player always gets at least one enchantment on an item, and there is a chance of receiving more. Additional enchantments are chosen by this algorithm:

  1. With probability (modified level + 1) / 50, keep going. Otherwise, stop picking bonus enchantments.
  2. Remove from the list of possible enchantments anything that conflicts with previously-chosen enchantments.
  3. Pick one enchantment from the remaining possible enchantments (based on the weights, as before) and apply it to the item.
  4. Divide the modified level in half, rounded down (this does not affect the possible enchantments themselves, because they were all pre-calculated in Step Two).
  5. Repeat from the beginning.

This part took the longest to do. Basically, I just followed this algorithm for each final modified enchantment level 24–65, and then multiplied the results from that algorithm with the probabilities of getting each of those enchantment levels. Finally, all of that was added together.