There's some validity to this approach. It's called a fragmentation warhead. However, frag warheads are usually detonated near the target. You describe this as an "anti-fleet" weapon, which to me implies that you aren't targeting a single craft. You're targeting a fleet in general and trying to inflict multiple causalities.
The problem is distances. A best case scenario says that these slugs spread out in a uniform disk that heads towards the target. The idea of a frag warhead is that the expected number of hits on your target (or targets) is equal to the number of fragments times the fraction of the area of the disk that your target covers. If you spread 50 fragments over a $10\text{m}^2$ disk and are trying to hit a $2\text{m}^2$ target, you expect that on average $50\times(\frac{2}{10})=10$ fragments will hit the craft.
Now space is big. Really big. Really really really really really big. That spread is going to cause problems. Let's back up and take on a more terrestrial example. A modern carrier battle group will have an outer screen of ships to detect the enemy at up to $370\text{km}$ and an inner screen of ships within about $19\text{km}$ to dispatch them. Let's pretend our carrier group is all bunched up within $20\text{km}$. The exact makeup of a carrier group isn't very specific, but for our rules of thumb, let's say its 6 destroyers (like DDG-59), 2 AEGIS cruisers, and a supercarrier. According to wikipedia, this is not an unreasonable makeup for our example purposes. The surface areas of these ships are roughly destroyer: $3000\text{m}2$, AEGIS: $3111\text{m}2$ and Nimitz carrier: $25564\text{m}2$. Sum total, that's going to be somewhere on the order of $50000\text{m}2$, or $0.050\text{km}^2$ of surface area to hit. That carrier group is spread over roughly $300\text{km}^2$ of surface, yielding a ratio of $6000:1$. This means for every $1$ hit you want on this unusually bunched up carrier group, you need $6000$ pellets. Now practically speaking, you probably wont expect a single pellet to kill a ship. These are warships, after all. You will want to multiply that by some factor.
Now let's get into space. Space is big. Really Big... Wait, I said that already. The distances between things are much larger. For the ISS, a "close approach" of debris to the space station is defined to be about $25\text{km}$ in radius. That means that the ISS seriously considers spending fuel to change course. In our seafaring example, we had all 9 of our ships bunched up to within a $10\text{km}$ radius ($20\text{km}$ diameter). If we assume the ISS was our supercarrier, with a surface area of $0.025\text{km}^2$ within this radius, we should expect to need roughly $80,000$ pellets in order to achieve a single pellet impact. Again, I would expect it to take a substantial number of hits to get a kill against a warship designed to take on not only these pellets, but the general debris in space.
In interplanetary space, the distances get larger. We don't exactly have SOPs for interplanetary fleets, but distances of $1000\text{km}$ between ships would not be unreasonable at all. At those distances, such a shotgun approach becomes simply meaningless.
So the next question is to find out how heavy your fragments are. Let's say you want to get $100$ hits on your target, with $100\text{g}$ fragments. That calls for $8$ million fragments at $0.1\text{kg}$ each, or $800,000\text{kg}$. The ISS is about $400,000\text{kg}$. Even if we drop our standards and use $10\text{g}$ fragments, it's still $80,000\text{kg}$, or $20\%$ of the mass of the space station.
Which is going to lead to visibility. The larger a weapon, the easier it will be to detect. A warfleet is going to have a vested interest in detecting weapons approaching them. A weapon that's a good fraction of the size of the ISS is going to be relatively easy to spot as it approaches.
Which brings up an interesting quirk of the weapon. You don't really need the nuke. In space, things move fast. Orbital velocities are on the order of $8\text{km/s} (8000\text{m/s}$) and interplanetary speeds are necessarily higher. At those speeds, you don't really need an explosive to impart additional velocity. Simply shoot at the craft from any direction other than from behind, and the relative velocities of the fleet vs the pellets will give you all the lethality you were going to get.
A nuke would let you achieve the desired spread quickly, by giving each particle a larger cross-range velocity. This is helpful if you want to get in close, but getting in close with a weapon that's a fraction the size of the ISS isn't realistic. You might as well impart less velocity, with a smaller explosive, and do it earlier, giving the slugs more time to spread out. This would also give you the opportunity to make the slugs into precise shapes to improve lethality, and avoid the whole "nuclear bombs like to melt things" issue.