This post discusses two possible igraph community functions that allow you to set a specific number of communities:
Quoting from Jim Leach:
You can use either the cluster_spinglass() function and set spins to be the number of communities desired. Or use one of the hierarchical methods and then use cut_at() to get the desired number of communities, using the no argument to specify how many communities you want.
Note that the spinglass method will give you back a communities object, whereas the cut_at method simply gives you back the community indices for all nodes in the graph (i.e. a simple numeric vector).
However, unless there is a specific network metric that you want to inform the formation of your communities, you might just want to use a normal k-means clustering algorithm directly on the weight adjacency matrix, something like this: