This way is more about having a light ignore the object, than having the object ignore the light. If you're prepared to use OSL and CPU rendering, (which may slow things down too much for you), you can use this little OSL script in a lamp's shader, which returns the index of the object it's lighting directly, for each ray sample.
#include "stdosl.h"
shader LitObjectIDX(
output float ObjectIdx = 0.0
)
{
if (trace(P,I)){
getmessage("trace", "object:index", ObjectIdx);
}
}
In the Render panel, enable CPU rendering, and OSL.
In the Properties > Object > Relations panel, assign a Pass Index to the objects you're interested in discriminating. In this example, there are two cubes - the one on the left has an index of 10, the one on the right, 20. They both have plain white BSDF materials.

One spotlight, shaded with the node tree shown on the left, is lighting the scene. With this set-up, it lights the left cube pink and the right cube green.(You could use the objects' indices in any way you choose, including ignoring all objects within a range of ID's)
EDIT in response to comments:
Yes you can have more than two colors, because you can do anything you like with the Object IDs. In this example, the objects have IDs of 2,4,6,8 and 10 respectively, and the plane they're sitting on has an ID of 12.

Here, I've got rid of the bounced diffuse light the clunky way, by simply going to the Properties > Cycles Settings of all the objects except the plane, and unchecking the 'Diffuse' ray visibility in each of them. That means they make no bounced diffuse contribution to the lighting in the scene at all.
If you wanted more control than that, you could use a combination of the Light Path node with the OSL node given here, in the shading of the objects, to specify which other objects received a diffuse contribution from them, and how. (That would be treating the objects in much the same way as we have treated the lamps in this answer. From the point of view of their diffuse, light-scattering rays, objects are lamps ... sort of.)
For the use of the Light Path node, and getting your head around reverse ray-tracing, I think this is a nice tutorial.